Part Number Hot Search : 
TOM12215 XC6413 CP576 SMC120A C4443I 783AP SSM2141 NVD4804N
Product Description
Full Text Search
 

To Download EM78P330N Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  em78p330/331nxj/xs 8-bit microprocessor with otp rom product specification d oc . v ersion 1.1 elan microelectronics corp. march 2007 www.datasheet.net/ datasheet pdf - http://www..co.kr/
trademark acknowledgments : ibm is a registered trademark a nd ps/2 is a trademark of ibm. windows is a trademark of microsoft corporation. elan and elan logo are trademarks of elan mi croelectronics corporation. copyright ? 2007 by elan microelectronics corporation all rights reserved printed in taiwan the contents of this specification are subject to change without further notice. elan microelectronics assumes no responsibility concerning the accuracy, ad equacy, or completeness of this sp ecification. elan microelectronics makes no commitment to update, or to keep current the information and material contained in this specification. such information and material may change to conform to each confirmed order. in no event shall elan microelectronics be made responsible for any claims attributed to errors, omissions, or other inaccuracies in the information or material contained in this specification. elan microelectronics shall not be liable for direct, indirect, special incidental, or consequential damages arising from the use of such information or material. the software (if any) described in this specification is furnished under a license or nondisclosure agreement, and may be used or copied only in accordan ce with the terms of such agreement. elan microelectronics products are not intended for use in life support appliances, devices, or systems. use of elan microelectronics product in such applications is not supported and is prohibited. no part of this specification may be reproduced or transmitted in any form or by any means without the expressed written permission of elan microelectronics. elan microelectronics corporation headquarters: no. 12, innovation road 1 hsinchu science park hsinchu, taiwan 30077 tel : +886 3 563-9977 fax : +886 3 563-9966 http : //www.emc.com.tw hong kong: elan (hk) microelectronics corporation, ltd. flat a, 19f., world tech centre 95 how ming street, kwun tong kowloon , hong kong tel : +852 2723-3376 fax : +852 2723-7780 elanhk@emc.com.hk usa: elan information technology group (usa) 1821 saratoga ave., suite 250 saratoga, ca 95070 usa tel : +1 408 366-8225 fax : +1 408 366-8220 shenzhen: elan microelectronics shenzhen, ltd. ssmec bldg., 3f, gaoxin s. ave. shenzhen hi-tech industrial park shenzhen, guandong, china tel : +86 755 2601-0565 fax : +86 755 2601-0500 shanghai: elan microelectronics shanghai, ltd. 23/bldg. #115 lane 572, bibo roa d zhangjiang hi-tech park shanghai, china tel : +86 21 5080-3866 fax : +86 21 5080-4600 www.datasheet.net/ datasheet pdf - http://www..co.kr/
contents product specification (v1.1) 03.13.2007 ? iii contents 1 general description .................................................................................................. 1 2 features ..................................................................................................................... 1 3 pin assignment ......................................................................................................... 2 4 functional block diagram........................................................................................ 3 5 pin description.......................................................................................................... 4 5.1 EM78P330N ....................................................................................................... 4 5.2 em78p331n ....................................................................................................... 5 6 function description ................................................................................................ 6 6.1 operational registers......................................................................................... 6 6.1.1 r0 (indirect address register) ...........................................................................6 6.1.2 r1 (time cl ock/counter).....................................................................................6 6.1.3 r2 (program co unter) and stack........................................................................6 6.1.3.1 data memory configuration .................................................................8 6.1.4 r3 (statu s register) ............................................................................................9 6.1.5 r4 (ram sele ct register) ...................................................................................9 6.1.6 r5 ~ r8 (por t 5 ~ port 8) ..................................................................................10 6.1.7 r9 (tmr4: ti mer 4 regi ster) ............................................................................10 6.1.8 ra (spirb: spi read buff er) ...........................................................................10 6.1.9 rb (spiwb: spi write bu ffer)...........................................................................10 6.1.10 rc (spis: spi status regi ster) ........................................................................10 6.1.11 rd (spic: spi c ontrol register) ......................................................................11 6.1.12 re (wucr: wake- up control r egister) ...........................................................12 6.1.13 rf (interrupt status regi ster) ...........................................................................13 6.1.14 r10 ~ r3f .........................................................................................................14 6.1.15 bank 1 r5 (pwm control regist er #1) .............................................................14 6.1.16 bank 1 r6 (pwm control regi ster 2) ...............................................................15 6.1.17 bank1 r7 (pwm timer/ counter control register) ...........................................16 6.1.18 bank1 r8 (prd1h: most significant byte of pwm1 time period).........................16 6.1.19 bank1 r9 (prd2h: most significant byte of pwm2 time period).........................16 6.1.20 bank1 ra (prd3h: most significant byte of pwm3 time period).........................16 6.1.21 bank1 rb (prdl: least significant bits of pwm peri od cycle) ......................17 6.1.22 bank 1 rc (dt1h: most signifi cant byte of pwm1 duty cycle)......................17 6.1.23 bank 1 rd (dt2h: most signifi cant byte of pwm2 duty cycle)......................17 6.1.24 bank1 re (dt3h: most signifi cant byte of pwm3 duty cycle) .......................17 6.1.25 bank1 rf (dtl: least signifi cant bits of pwm duty cycle) ............................17 6.1.26 bank 2 r6 (bocon: buzze r output contro l register).....................................18 6.1.27 bank 2 r7 (syste m control r egister) ...............................................................19 6.1.28 bank 2 r8 (aisr: a dc input select register)..................................................20 6.1.29 bank 2 r9 (adcon: adc control re gister ) ....................................................21 6.1.30 bank 2 ra (adoc: adc offset calibrati on register).......................................22 www.datasheet.net/ datasheet pdf - http://www..co.kr/
contents iv ? product specificati on (v1.1) 03.13.2007 6.1.31 bank 2 rb (addata: converted val ue of a dc) .............................................. 23 6.1.32 bank 2 rc (addata1h: converted valu e of adc)..........................................23 6.1.33 bank 2 rd (addata1l: converted valu e of adc) ..........................................23 6.1.34 bank 2 re (lvdc: lvd control re gister ) .......................................................24 6.1.35 bank 2 rf (tmr3h: most si gnificant bits of pwm3 ti mer) .............................24 6.1.36 bank3 r5 (pull-lo w control regi ster 1) ............................................................24 6.1.37 bank 3 r6 (pull-lo w control regi ster 2) ..........................................................25 6.1.38 bank3 r7 (pull-lo w control regi ster 3) ...........................................................25 6.1.39 bank3 r8 (pull-lo w control regi ster 4) ............................................................26 6.1.40 bank3 r9 (pull-hi gh control regi ster 1) ..........................................................26 6.1.41 bank 3 ra (pull-hi gh control regi ster 2) .........................................................26 6.1.42 bank 3 rb (pull-hi gh control r egister 3)..........................................................27 6.1.43 bank 3 rc (pull-hi gh control r egister 4) .........................................................27 6.1.44 bank 3 rd (tmr1h: most si gnificant bits of pwm1 ti mer) .............................28 6.1.45 bank 3 re (tmr2h: most si gnificant bits of pwm2 ti mer) .............................28 6.1.46 bank 3 rf (tmrl: least si gnificant bits of pwm ti mer).................................28 6.2 special purpose registers ............................................................................... 28 6.2.1 a (accum ulator ).................................................................................................28 6.2.2 cont (contro l register)...................................................................................28 6.2.3 ioc5 ~ ioc8 (i/o po rt control r egister) ..........................................................29 6.2.4 ioc9 (t4con: timer 4 control r egister) .........................................................29 6.2.5 ioca (tcmpcon: compar ator control register) ............................................30 6.2.6 ioce (wdt c ontrol regi ster) ...........................................................................30 6.2.7 iocf (interrupt mask register).........................................................................32 6.3 tcc/wdt and prescaler.................................................................................. 33 6.4 i/o ports ........................................................................................................... 34 6.4.1 usage of port 6 input chan ge wake-up/interr upt function..............................37 6.5 serial peripheral interface mode...................................................................... 37 6.5.1 overview and features .....................................................................................37 6.5.2 spi function descript ion..................................................................................39 6.5.3 spi signal and pin descrip tion .........................................................................41 6.5.4 programming the re lated regi sters .................................................................42 6.5.5 spi m ode timi ng ...............................................................................................45 6.5.6 spi software application ...................................................................................46 6.6 timer 4 ............................................................................................................. 48 6.6.1 over view ...........................................................................................................48 6.6.2 function description..........................................................................................48 6.6.3 programming the re lated regi sters .................................................................49 6.7 reset and wake-up.......................................................................................... 50 6.7.1 reset and wake -up operat ion..........................................................................50 6.7.1.1 wake-up and interrupt mode operati on summa ry ............................53 6.7.1.2 register initial values afte r reset ......................................................55 6.7.1.3 controller rese t block di agram.........................................................62 6.7.2 the t and p status und er status regist er ........................................................63 www.datasheet.net/ datasheet pdf - http://www..co.kr/
contents product specification (v1.1) 03.13.2007 ? v 6.8 interrupt ............................................................................................................ 63 6.9 analog-to-digital converter (adc) ................................................................... 65 6.9.1 adc control regist er (aisr/bank 2 r8, adcon/ bank 2 r9, adoc/ bank 2 ra) ............................................................................................65 6.9.1.1 bank 2 r8 (aisr: a dc input select register)...................................65 6.9.1.2 bank 2 r9 (adcon: adc control re gister) .....................................66 6.9.1.3 bank 2 ra (adoc: adc offset calibration register)........................68 6.9.2 adc data register (addata/ bank 2 rb, addata1h/bank 2 rc, addata1l/bank 2 rd) .....................................................................................68 6.9.3 adc samp ling time ..........................................................................................68 6.9.4 ad conv ersion time .........................................................................................68 6.9.5 adc operation during sle ep mode ...................................................................69 6.9.6 programming proces s/considerations..............................................................69 6.9.6.1 programmi ng process........................................................................69 6.9.6.2 sample de mo programs ....................................................................70 6.10 dual sets of pwm (pulse width modulation) ................................................... 72 6.10.1 over view ...........................................................................................................72 6.10.2 increment timer c ounter ..................................................................................73 6.10.3 pwm time period .............................................................................................73 6.10.4 pwm duty cycle ...............................................................................................74 6.10.5 comparator x ....................................................................................................74 6.10.6 pwm programming process/steps...................................................................74 6.11 timer ................................................................................................................ 74 6.11.1 ov erview ...........................................................................................................74 6.11.2 function description..........................................................................................75 6.11.3 programming the related regi sters .................................................................76 6.11.3.1 related cont rol registers of tm r1, tmr2, and tmr3.....................76 6.11.4 timer programmi ng process/steps...................................................................76 6.12 comparator ...................................................................................................... 76 6.12.1 external re ference signal ................................................................................77 6.12.2 comparator outputs..........................................................................................77 6.12.3 using comparator as an operation am plifier....................................................78 6.12.4 comparator interr upt .........................................................................................78 6.12.5 wake-up fr om sleep mode................................................................................78 6.13 oscillator .......................................................................................................... 78 6.13.1 oscilla tor mo des................................................................................................78 6.13.2 crystal oscillator/ceram ic resonators (crystal)...............................................79 6.13.3 external rc oscillator mode.............................................................................80 6.13.4 internal rc oscillator mode ..............................................................................81 6.14 power-on considerations ................................................................................. 82 6.14.1 external power- on reset ci rcuit .......................................................................82 6.14.2 residual vo ltage protec tion ..............................................................................83 6.15 lvd (low voltage detector) ............................................................................. 84 www.datasheet.net/ datasheet pdf - http://www..co.kr/
contents vi ? product specificati on (v1.1) 03.13.2007 6.16 code option ..................................................................................................... 85 6.16.1 code option r egister (w ord 0) .........................................................................85 6.16.2 code option r egister (w ord 1) .........................................................................87 6.15.3 customer id r egister (w ord 2) .........................................................................87 6.17 instruction set .................................................................................................. 88 7 absolute maximum ratings ................................................................................... 90 8 dc electrical characteristics ................................................................................. 91 8.1 ad converter characteristic............................................................................. 92 8.2 comparator (op) characteristic ....................................................................... 93 8.3 device characteristics...................................................................................... 94 9 ac electrical characteristic ................................................................................... 95 10 timing diagrams ..................................................................................................... 96 appendix a package type........................................................................................................... 97 b packaging configurations...................................................................................... 98 b.1 28-lead plastic dual in line (pdip) ? 600 mil ................................................. 98 b.2 28-lead plastic small outline (sop) ? 300 mil .............................................. 99 b.3 28-lead shrink dual in line (sdip) ? 400 mil .............................................. 100 b.4 28-lead shrink dual in line (sdip) ? 300 mil .............................................. 101 b.5 32-lqfp 7 77m2 ........................................................................................ 102 b.6 32-lead shrink dual in line (sdip) ?400 mil ................................................ 103 b.7 32-lead plastic dual in line (pdip) ?600 mil ................................................ 104 b.8 32-lead plastic small outline (sop) ? 300 mil ............................................ 105 c quality assurance and reliability ..................................................................... 106 c.1 address trap detect....................................................................................... 106 specification revision history doc. version revision description date 1.0 initial version 2007/01/03 1.1 modified section b.8 of appendix 2007/03/13 www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom product specification (v 1.1) 03.13.2007 ? 1 (this specification is subject to change without further notice) 1 general description the em78p330/331n is an 8-bit microprocessors des igned and developed with low-power and high-speed cmos technology. it has an on-chip 8k 13-bit electrical one time programmable read only memory (otp-rom). it provides a protection bit to prevent intrusion of us er?s otp memory code. three code option bits are also available to meet user?s requirements. with its enhanced otp-rom feature, the EM78P330N provides a convenient way of devel oping and verifying user?s programs. moreover, this otp device offers the advant ages of easy and effective progr am updates, using development and programming tools. user can avail of the elan writer to easily program his development code. 2 features ? cpu configuration ? 8k 13 bits on chip rom ? 144 8 bits on chip registers (sram) ? 8 level stacks for subroutine nesting ? 4 programmable level voltage detector (lvd) : 4.5v, 4.0v, 3.3v, 2.2v ? 4 programmable level voltage reset (lvr) : 4.0v, 3.5v, 2.7v, 1.8v (por) ? less than 2.2 ma at 5v/4mhz ? typically 15 a, at 3v/32khz ? typically 1 a, during sleep mode ? i/o port configuration ? 4 bidirectional i/o ports : p5, p6, p7, p8 ? 29 i/o pins ? wake-up port : p6 ? 29 programmable pull-down i/o pins ? 29 programmable pull-high i/o pins ? external interrupt : p52, p53 ? operating voltage range: ? otp version: operating voltage range: 2.1v~5.5v ? operating temperature range : -40~85 c ? operating frequency range: main clock ? crystal mode: dc~20mhz/2clks @ 5v; dc~100ns inst. cycle @ 5v dc~8mhz/2clks @ 3v; dc ~ 25 0ns inst. cycle @ 3v ? erc mode: dc~16mhz/2clks @ 5v; dc~125ns inst. cycle @ 5v dc~8mhz/2clks @ 3v; dc~250ns inst. cycle @ 3v ? irc mode: oscillation mode : 4mhz, 8mhz, 1mhz, 455khz process deviation : typ3%, max5% temperature deviation : 5% (-40c~85c ) sub clock crystal: 32.768khz all these four main frequencies can be trimmed by programming with four calibrated bits in the ice330n simulator. otp is auto trimmed by elan writer ? peripheral configuration ? serial peripheral interface (spi) available ? 8-bit real time clock/counter (tcc) with selective signal sources, trigger edges, and overflow interrupt ? 8-bit channels analog-to-digital converter with 12-bit resolution in vref mode ? three pulse width modulation (pwm ) with 10-bit resolution ? one pair of comparators or op ? one 10-bit timer. two 10-bit timer with selective signal sources and trigger edges. all of these have interrupt function. ? eight available interrupts: ? tcc overflow interrupt ? input-port status changed interrupt (wake-up from sleep mode) ? two external interrupt ? adc completion interrupt ? pwm time period match completion interrupt ? comparator high/low interrupt ? serial i/o interrupt ? low voltage detect (lvd) ? special features ? programmable free running watchdog timer ? high esd immunity ? high eft immunity ? power saving sleep mode ? selectable oscillation mode ? package types: ? 28 pin dip 600mil : EM78P330Nps/j ? 28 pin sop 300mil : EM78P330Nms/j ? 28 pin sdip 400mil : EM78P330Nks/j ? 28 pin sdip 300mil : EM78P330Naks/j ? 32 pin lqfp : em78p331nqs/j ? 32 pin sdip 400mil : em78p331nks/j ? 32 pin dip 600mil : em78p331nps/j ? 32 pin sop 300mil : em78p331nms/j note: green products do not cont ain hazardous substances. www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom 2 ? product specification (v1.1) 03.13.2007 (this specification is subjec t to change without further notice) 3 pin assignment (1) 28-pin dip/sop p74/xout p50/osco tcc/p57 co/p56 int1/p53 p73/xin p81/sout ain4/p64 ain3/p63 ain2/p62 pwm2/p71 p83/bo p76/cntr1 p80/sck p75//ss cin+/p55 vdd p84/vref int0/p52 cin-/p54 ain5/p65 ain1/p61 pwm1/p70 EM78P330N 1 2 3 4 5 6 7 8 9 10 28 27 26 25 24 23 22 21 12 11 18 17 16 15 13 14 20 19 /reset p51/osci vss p82/sin ain0/p60 fig. 3-1 EM78P330Nps/nms/j (2) 32-pin lqfp p73/xin p74/xout p75/ss p76/cntr1 p77/cntr2 p80/sck p81/sout p82/sin p67/ain7 p54/cin- p55/cin+ p56/co p57/tcc p70/pwm1 p71/pwm2 p72/pwm3 p66/ain6 p65/ain5 p64/ain4 p63/ain3 p62/ain2 p61/ain1 p60/ain0 p53/int1 p52/int0 p84/vref vdd vss p51/osci p50/osco p83/bo /reset 24 23 22 21 20 19 18 17 25 26 27 28 29 30 31 32 1 2 3 4 5 6 7 8 16 15 14 13 12 11 10 9 fig. 3-2 em78p331nqs/j (3) 32-pin sop/sdip/dip p76/cntr1 p51/osci co/p56 cin+/p55 p75//ss p82/sin ain5/p65 ain4/p64 ain3/p63 pwm2/p71 pwm1/p70 p50/osco p80/sck p81/sout p77/cntr2 cin-/p54 ain7/p67 ain6/p66 ain2/p62 pwm3/p72 p73/xin p74/xout tcc/p57 em78p331n 1 2 3 4 5 6 7 8 9 10 28 27 26 25 24 23 22 21 12 11 32 31 30 29 1 3 14 15 20 19 18 17 16 ain0/p60 p84/vref int0/p52 int1/p53 p83/bo vss vdd /reset ain1/p61 fig. 3-3 em78p331nks/nps/nms/j www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom product specification (v 1.1) 03.13.2007 ? 3 (this specification is subject to change without further notice) 4 functional block diagram rom r3 (status reg.) acc instruction decoder instruction register alu pc interrupt circuit 8-level stack (13 bit) interrupt control register oscillation generation ram mux . ext. osc. r4 ext. rc int. rc start-up timer wdt pwm1 (timer 1) pwm2 (timer 2) pwm3 (timer 3) buzzer spi tcc cntr 1 cntr 2 adc comparator (co) or op lvr lvd ain0~7 cin+ cin- co pwm1 pwm3 pwm2 buzzer out sin sout sck tcc cntr2 cntr1 p5 p50 p57 p56 p55 p54 p53 p52 p51 ext int sub osc reset p6 p60 p67 p66 p65 p64 p63 p62 p61 p7 p70 p77 p76 p75 p74 p73 p72 p71 p8 p80 p84 p83 p82 p81 fig. 4-1 EM78P330N functional block diagram www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom 4 ? product specification (v1.1) 03.13.2007 (this specification is subjec t to change without further notice) 5 pin description 5.1 EM78P330N symbol pin no. type function p50~p57 10~11 15~16 25~26 i/o 8-bit general purpose input/output pins default value at power-on reset p60~p65 17~22 i/o 6-bit general purpose input/output pins default value at power-on reset p70~p71 p73~p76 27, 28 1~4 i/o 6-bit general purpose input/output pins default value at power-on reset p80 ~ p84 5~7 9, 14 i/o 5-bit general purpose input/output pins default value at power-on reset int0, int1 15, 16 i external interrupt pin triggered by falling edge ain0~ain5 17~22 i 6-bit analog-to-digital converter defined by aisr (bank 2 r8) <0 : 7> pwm1 pwm2 27 28 o pulse width modulation outputs defined by pwmcon (bank 1-r5)<5 : 7> bo 9 o buzzer output driver vref 14 i external reference voltage for adc defined by adcon (bank 2 r9) <7>. cin- cin+ co 23 24 25 i i o ?-? : the input pin of vi n- of the comparator ?+? : the input pin of vin+ of the comparator pin co is the comparator output defined by cmpcon (ioca) <0:1> /reset 8 i general-purpose input only if it remains at logic low, the device will be reset wake-up from sleep mode when pin status changes voltage on /reset must not exceed vdd during normal mode tcc 26 i real time clock/counter with schmitt trigger input pin. it must be tied to vdd or vss if not in use. cntr1 4 i counter 1 / counter 2 with schmitt trigger input pin. sin 7 i sin pin is used to input serial data signals by software. sin pin is also used as port p82. sout 6 o sout pin is used to input serial data signals by software. sout pin is also used as port p81. sck 5 i/o sck pin is used to input and output synchronous clock signals for serial data transfer by software. sck pin is also used as port p80. osci 11 i crystal type: crystal input terminal or external clock input pin rc type: rc oscillator input pin osco 10 o crystal type: output terminal for crystal oscillator or external clock input pin. rc type: clock output with a duration of one instruction cycle time. the prescaler is determined by the cont register. external clock signal input. xin 1 i low crystal 32.768khz input xout 2 o low crystal 32.768khz output vdd 13 ? power supply vss 12 ? ground www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom product specification (v 1.1) 03.13.2007 ? 5 (this specification is subject to change without further notice) 5.2 em78p331n symbol pin no. type function p50~p57 11~12 16~17 27~30 i/o 8-bit general purpose input/output pins default value at power-on reset p60~p67 18~25 i/o 8-bit general purpose input/output pins default value at power-on reset p70~p77 30~32 1~5 i/o 8-bit general purpose input/output pins default value at power-on reset p80 ~ p84 6~8 10, 15 i/o 5-bit general purpose input/output pins default value at power-on reset int0, int1 16, 17 i external interrupt pin triggered by a falling edge ain0~ain7 18~25 i 8-bit analog-to-digital converter defined by aisr (bank 2 r8) <0 : 7> pwm1 pwm2 pwm3 30 31 32 o pulse width modulation outputs defined by pwmcon (bank 1-r5)<5 : 7> bo 10 o buzzer output driver vref 15 i external reference voltage for adc defined by adcon (bank 2 r9) <7>. cin- cin+ co 26 27 28 i i o ?-? : the input pin of vi n- of the comparator ?+? : the input pin of vin+ of the comparator pin co is the comparator output defined by cmpcon (ioca) <0:1> /reset 9 i general-purpose input only if it remains at logic low, the device will be reset wake-up from sleep mode when pin status changes voltage on /reset must not exceed vdd during normal mode tcc 57 i real time clock/counter with schmitt trigger input pin. it must be tied to vdd or vss if not in use. cntr1 cntr2 4 5 i counter 1 / counter 2 with schmitt trigger input pin. sin 8 i sin pin is used to input serial data signals by software. sin pin is also used as port p82. sout 7 o sout pin is used to input serial data signals by software. sout pin is also used as port p81. sck 6 i/o sck pin is used to input and output synchronous clock signals for serial data transfer by software. sck pin is also used as port p80. osci 12 i crystal type: crystal input terminal or external clock input pin rc type: rc oscillator input pin osco 11 o crystal type: output terminal for crystal oscillator or external clock input pin. rc type: clock output with a duration of one instruction cycle time. the prescaler is determined by the cont register. external clock signal input. xin 1 i low crystal 32.768khz input xout 2 o low crystal 32.768khz output vdd 14 ? power supply vss 13 ? ground www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom 6 ? product specification (v1.1) 03.13.2007 (this specification is subjec t to change without further notice) 6 function description 6.1 operational registers 6.1.1 r0 (indirect address register) r0 is not a physically implemented register. its major function is to perform as an indirect address pointer. any instruction us ing r0 as a pointer, actually accesses the data pointed by the ram select register (r4). 6.1.2 r1 (time clock/counter) ? incremented by an external signal edge thr ough the tcc pin, or by the instruction cycle clock. ? external signal of tcc trigger pulse widt h must be greater than one instruction. ? the signals to increment the counter are determined by bit 4 and bit 5 of the cont register. ? writable and readable as any other registers. 6.1.3 r2 (program counter) and stack pc (a12 ~ a0) stack level 1 stack level 3 stack level 2 stack level 8 on-chip program memory interrupt vector user memory space reset vector 000h 1fffh 008h fig. 6-1 program counter organization ? r2 and hardware stacks are 13-bit wide. the structure is depicted in the table under section 6.1.3.1 data memory configuration (next section). ? generates 8k 13 bits on-chip rom addresses to the relative programming instruction codes. one program page is 1024 words long. ? the contents of r2 are all set to "0"s when a reset condition occurs. ? "jmp" instruction allows direct loading of the lower 10 program counter bits. thus, "jmp" allows pc to jump to any location within a page. www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom product specification (v 1.1) 03.13.2007 ? 7 (this specification is subject to change without further notice) ? "call" instruction loads the lower 10 bits of the pc, and then pc+1 is pushed onto the stack. thus, the subroutine entry ad dress can be located anywhere within a page. ? "ret" ("retl k", "reti") instruction load s the program counter with the contents of the top of stack. ? "add r2, a" allows a relative address to be added to the current pc, and the ninth and above bits of the pc will increase progressively. ? "mov r2, a" allows loading of an address from the "a" register to the lower 8 bits of the pc, and the ninth and tenth bits (a8 ~ a9) of the pc will remain unchanged. ? any instruction (except ?add r2,a?) that is written to r2 (e.g., "mov r2, a", "bc r2, 6", ????? ) will cause the ninth bit and the tenth bit (a8 ~ a9) of the pc to remain unchanged. ? in the case of EM78P330N, the most three significant bits (a12,a11 and a10) will be loaded with the content of ps2,ps1 and ps0 in the status register (r3) upon execution of a "jmp", "call", or any other instructions set which write to r2. ? all instructions are single instruction c ycle (fclk/2 or fclk/4) except for the instructions that are written to r2. note that these instructions need one or two instructions cycle as determined by code option register cyes bit. www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom 8 ? product specification (v1.1) 03.13.2007 (this specification is subjec t to change without further notice) 6.1.3.1 data memory configuration 05 06 07 08 09 0a 0b 0c 0d 0e 0f 04 03 02 01 r1 (tcc buffer) r2 (pc) r3 (status) r4 (rsr, bank select) r5 (port 5 i/o data) r6 (port 6 i/o data) r5 (pwm control register #1) r6 (pwm control register #2) r9 (adc control register) r7 (port 7 i/o data) r8 (port 8 i/o data) r9 (timer 4 control register) r7 (pwm timer/counter control register) rb (addata adc data bit11~bit4) rc (addata1h adc data bit 11~bit 8) rd (adata1l adc data bit 7~bit 0) re (wake-up control register) rf (interrupt flag) ioc6 (port 6 i/o control) ioc7 (port 7 i/o control) ioc8 (port 8 i/o control) ioc9 (timer 4 control register) ioce (wdt control register) iocf (interrupt mask 1) 16-byte common register 10 : 1f bank 0 32 x 8 bank 1 32 x 8 bank 2 32 x 8 bank 3 32 x 8 20 : 3f r4 (7, 6) address register bank 0 register bank 1 register bank 2 control register (0, 1) (1, 0) register bank 3 ra (spi read buffer) ra (adc offset calibration register) r6 (buzzer output control register) r7 (system control register) r8 (tadc input select register) ioc5 (port 5 i/o control) ioca (comparator control register ) r9 (prd2h: pwm2 period) rd (dt2l: pwm2 duty cycle) rb (spi write buffer) rc (spi status buffer) rd (spi control buffer ) r8 (prd1h: pwm1 period) ra (prd3h: pwm3 period) rb (prdl: pwm period cycle) rc (dt1l: pwm1 duty cycle) re (dt3l: pwm3 duty cycle) rf (dth: pwm duty cycle) re (lvdc : lvd control) r5 (pull low control 1) r6 (pull low control 2) r7 (pull low control 3) r8 (pull low control 4) r9 (pull high control 1) ra (pull high control 2) rb (pull high control 3) rc (pull high control 4) rf (tmrl: pwm timer) re (timer2h: pwm2 timer) rd (timer1h: pwm1 timer) rf (timer3h: pwm3 timer) r4 (7, 6) reserved reserved reserved reserved (1, 1) r4 (7, 6) www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom product specification (v 1.1) 03.13.2007 ? 9 (this specification is subject to change without further notice) 6.1.4 r3 (status register) bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 ps2 ps1 ps0 t p z dc c bits 7 ~ 5 (ps2 ~ ps0) page select bits. ps2~ps0 are used to pre-select a program memory page. when executing a "jmp", "ca ll", or other instructions which causes the program counter to change (e.g. mov r2, a), ps2~ps0 are loaded into the 11th,12th and 13th bits of the program counter and select one of the available program memory pages. note that ret (retl, reti) instruction does not change the ps2~ps0 bits. that is, the return will alwa ys be to the page from where the subroutine was called, regardless of the ps2~ps0 bits current setting. ps2 ps1 ps0 program memory page [address] 0 0 0 page 0 [0000-03ff] 0 0 1 page 1 [0400-07ff] 0 1 0 page 2 [0800-0bff] 0 1 1 page 3 [0c00-0fff] 1 0 0 page 4 [1000-13ff] 1 0 1 page 5 [1400-17ff] 1 1 0 page 6 [1800-1bff] 1 1 1 page 7 [1c00-1fff] bit 4 (t): time-out bit. set to 1 by the "slep" and "wdtc" commands or during power on and reset to 0 by wdt time-out. bit 3 (p): power-down bit. set to 1 during power-on or by a "wdtc" command and reset to 0 by a "slep" command. note bit 4 & bit 3 (t & p) are read only. bit 2 (z): zero flag. set to "1" if the result of an arithmetic or logic operation is zero. bit 1 (dc): auxiliary carry flag bit 0 (c): carry flag 6.1.5 r4 (ram select register) bit 7 & bit 6: are used to select banks 0 ~ 3. bit 5 ~ bit 0: are used to select registers (address: 00 ~ 3f) in the indirect address mode. see the table under section 6.1.3.1 data memory configuration for the configuration of the data memory. www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom 10 ? product specification (v1.1) 03.13.2007 (this specification is subjec t to change without further notice) 6.1.6 r5 ~ r8 (port 5 ~ port 8) r5 ~ r7 are i/o registers. r8 is an i/o register. the upper 3 bits of r8 are fixed to 0. 6.1.7 r9 (tmr4: timer 4 register) bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 tmr47 tmr46 tmr45 tmr44 tmr43 tmr42 tmr41 tmr40 tmr47~tmr40 are set of timer 4 register bits which are incremented until the value matches pwp and then, it resets to 0. 6.1.8 ra (spirb: spi read buffer) bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 srb7 srb6 srb5 srb4 srb3 srb2 srb1 srb0 srb7~srb0 are 8-bit data when transmission is completed by spi. 6.1.9 rb (spiwb: spi write buffer) bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 swb7 swb6 swb5 swb4 swb3 swb2 swb1 swb0 swb7~swb0 are 8-bit data, waiting fo r transmission by spi. 6.1.10 rc (spis: spi status register) bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 dord td1 td0 t4ros od3 od4 - rbf bit 7 (dord): data transmission order. 0 :shift left (msb first) 1 :shift right (lsb first) bit 6~bit 5: sout status output delay times options td1 td0 delay time 0 0 8 clk 0 1 16 clk 1 0 24 clk 1 1 32 clk bit 4 (t4ros): timer4 read out buffer select bit 0 : read value from timer 4 preset register. 1 : read value from timer 4 counter register. bit 3 (od3): open-drain control bit 0 = open-drain disable for sout 1 = open-drain enable for sout www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom product specification (v 1.1) 03.13.2007 ? 11 (this specification is subject to change without further notice) bit 2 (od4): open-drain control bit 0 = open-drain disable for sck 1 = open-drain enable for sck bit 1 are not used and read as ?0?. bit 0 (rbf): read buffer full flag 0 = receiving not completed, and spirb has not fully exchanged. when users read spirb, rbf bit will be cleared. 1 = receiving completed; spi rb is fully exchanged. 6.1.11 rd (spic: spi control register) bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 ces spie sro sse sdoc sbrs2 sbrs1 sbrs0 bit 7 (ces): clock edge select bit 0 = data shifts out on a rising edge, and shifts in on a falling edge. data is on hold during a low-level. 1 = data shifts out on a falling edge, and shifts in on a rising edge. data is on hold during a high-level. bit 6 (spie): spi enable bit 0 = disable spi mode 1 = enable spi mode bit 5 (sro): spi read overflow bit 0 = no overflow 1 = a new data is received while the pr evious data is still being held in the spib register. in this situation, the data in spis register will be destroyed. to avoid setting this bit, users are required to read the spirb register although only t he transmission is implemented. note this can only occur in slave mode. bit 4 (sse): spi shift enable bit 0 = reset as soon as the shifting is completed, and the next byte is ready to shift. 1 = start to shift, and remain on ?1? wh ile the current by te is still being transmitted. note this bit will reset to 0 at every one-byte transmission by the hardware www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom 12 ? product specification (v1.1) 03.13.2007 (this specification is subjec t to change without further notice) bit 3 (soutc): sout output status control bit: 0 = after the serial data output, the sout remains high 1 = after the serial data output, the sout remains low bit 2~bit 0 (sbrs): spi baud rate select bits refer to the spi baud rate table under the ?spi? section on the subsequent pages. 6.1.12 re (wucr: wake- up control register) bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 EM78P330N ?0? ?0? ?0? lvdif * adwe cmpwe icwe pwmwe ice330n simulator c3 c2 c1 c0 adwe cmpwe icwe pwmwe * there is no lvd function in the ice330n simulator. bit 7 ~ bit 5: [EM78P330N]: unimplemented, read as ?0?. bit 4 (lvdif) (only for EM78P330N) : low voltage detector interrupt flag. lvden lvd1,lvd0 lvd voltage interrupt level lvdif 1 11 2.2v 1 * 1 10 3.3v 1 * 1 01 4.0v 1 * 1 00 4.5v 1 * 0 xx na 0 * if vdd has crossover at lvd voltage interrupt level as vdd changes, lvdif =1. [with simulator (c3~c0)]: are irc calibration bits in irc oscillator mode. in irc oscillator mode of ice330n simulator, thes e are the irc calibration bits of irc oscillator mode. c3 c2 c1 c0 frequency (mhz) 0 0 0 0 (1-36%) f 0 0 0 1 (1-31.5%) f 0 0 1 0 (1-27%) f 0 0 1 1 (1-22.5%) f 0 1 0 0 (1-18%) f 0 1 0 1 (1-13.5%) f 0 1 1 0 (1-9%) f 0 1 1 1 (1-4.5%) f 1 1 1 1 f (default) 1 1 1 0 (1+4.5%) f 1 1 0 1 (1+9%) f 1 1 0 0 (1+135%) f 1 0 1 1 (1+18%) f 1 0 1 0 (1+22.5%) f 1 0 0 1 (1+27%) f 1 0 0 0 (1+31.5%) f note: 1. frequency values shown are theoretical and tak en from an instance of a high frequency mode. hence, they are shown for reference only. definite values depend on the actual process. 2. similar way of calculation is also applicable for low frequency mode. www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom product specification (v 1.1) 03.13.2007 ? 13 (this specification is subject to change without further notice) bit 3 (adwe): adc wake-up enable bit 0 = disable adc wake-up 1 = enable adc wake-up when the adc complete is used to enter an interrupt vector or to wake-up the EM78P330N from sleep with ad conversion running, the adwe bit must be set to ?enable?. bit 2 (cmpwe): comparator wake-up enable bit 0 = disable comparator wake-up 1 = enable comparator wake-up when the comparator output status change is used to enter an interrupt vector or to wake-up EM78P330N from sleep, the cmpwe bit must be set to ?enable?. bit 1 (icwe): port 6 input change to wake-up status enable bit 0 = disable port 6 input change to wake-up status 1 = enable port 6 input change wake-up status when the port 6 input status change is used to enter an interrupt vector or to wake-up the EM78P330N from sleep, the icwe bit must be set to ?enable?. bit 0 (pwmwe): pwm/timer wake-up enable bit. 0 = disable pwm/timer wake-up 1 = enable pwm/timer wake up wake-up when the pwm/timer output status change is used to enter an interrupt vector or to wake-up the EM78P330N from sleep, the pwmwe must be set to ?enable?, this is reset by software. 6.1.13 rf (interrupt status register) bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 pwm3if pwm2if pwm1if adif exif1 exif0 icif tcif note ?1? means interrupt request; ?0? means no interrupt occurs. rf can be cleared by instruction but cannot be set. iocf is the interrupt mask register. reading rf will result to "logic and" of rf and iocf. bit 7 (pwm3if): pwm3 (pulse width modulation) in terrupt flag. set when a selected duration is reached. reset by software. bit 6 (pwm2if): pwm2 (pulse width modulation) in terrupt flag. set when a selected duration is reached. reset by software. www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom 14 ? product specification (v1.1) 03.13.2007 (this specification is subjec t to change without further notice) bit 5 (pwm1if): pwm1 (pulse width modulation) in terrupt flag. set when a selected duration is reached. reset by software. bit 4 (adif): interrupt flag for analog to digital co nversion. set when ad conversion is completed. reset by software. bit 3 (exif1): external interrupt flag. set by a falling edge on the /int1 pin. reset by software. bit 2 (exif0): external interrupt flag. set by a falling edge on the /int0 pin. reset by software. bit 1 (icif): port 6 input status change interrupt fl ag. set when port 6 input changes. reset by software. bit 0 (tcif): tcc overflow interrupt flag. set when tcc overflows. reset by software. 6.1.14 r10 ~ r3f all of these are 8-bit gener al-purpose registers. 6.1.15 bank 1 r5 (pwm control register #1) bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 pwm3e pwm2e pwm1e ?0? t1en t1p2 t1p1 t1p0 bit 7 (pwm3e): pwm3 enable bit 0 = pwm3 is off (default value), and its related pin carries out the p72 function 1 = pwm3 is on, and its related pin is automatically set as output bit 6 (pwm2e): pwm2 enable bit 0 = pwm2 is off (default value), and its related pin carries out the p71 function 1 = pwm2 is on, and its related pin is automatically set as output bit 5 (pwm1e): pwm1 enable bit 0 = pwm1 is off (default value), and its related pin carries out the p70 function 1 = pwm1 is on, and its related pin is automatically set to output bit 4: unimplemented, read as ?0? bit 3 (t1en): tmr1 enable bit 0 = tmr1 is off (default value) 1 = tmr1 is on www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom product specification (v 1.1) 03.13.2007 ? 15 (this specification is subject to change without further notice) bit 2 ~ bit 0 (t1p2 ~ t1p0): tmr1 clock prescale option bits t1p2 t1p1 t1p0 prescale 0 0 0 1:2 (default) 0 0 1 1:4 0 1 0 1:8 0 1 1 1:16 1 0 0 1:32 1 0 1 1:64 1 1 0 1:128 1 1 1 1:256 6.1.16 bank 1 r6 (pwm control register 2) bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 t2en t2p2 t2p1 t2p0 t3en t3p2 t3p1 t3p0 bit 7 (t2en): tmr2 enable bit 0 = tmr2 is off (default value) 1 = tmr2 is on bit 6 ~ bit 4 (t2p2 ~ t2p0): tmr2 clock prescale option bits t2p2 t2p1 t2p0 prescale 0 0 0 1:2 (default) 0 0 1 1:4 0 1 0 1:8 0 1 1 1:16 1 0 0 1:32 1 0 1 1:64 1 1 0 1:128 1 1 1 1:256 bit 3 (t3en): tmr3 enable bit 0 = tmr3 is off (default value) 1 = tmr3 is on bit 2 ~ bit 0 (t3p2 ~ t3p0): tmr3 clock prescale option bits t3p2 t3p1 t3p0 prescale 0 0 0 1:2 (default) 0 0 1 1:4 0 1 0 1:8 0 1 1 1:16 1 0 0 1:32 1 0 1 1:64 1 1 0 1:128 1 1 1 1:256 www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom 16 ? product specification (v1.1) 03.13.2007 (this specification is subjec t to change without further notice) 6.1.17 bank1 r7 (pwm timer/ counter control register) bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 ?0? ?0? ?0? ?0? t2ts t2te t1ts t1te bits 7~4: unimplemented, read as ?0? bit 3 (t2ts): timer 2 / counter 2 signal source 0 = internal instruction cycle clock. if p77 is used as i/o pin, t2ts must be 0 1 = transition on the cntr2 pin bit 2 (t2te): timer 2 / counter 2 signal edge 0 = increment if a transition from low to high takes place on the cntr2 pin 1 = increment if a transition from high to low takes place on the cntr2 pin bit 1 (t1ts): timer 1 / counter 1 signal source 0 = internal instruction cycle clock. if p76 is used as i/o pin, t1ts must be 0 1 = transition on the cntr1 pin bit 0 (t1te): timer 1 / counter 1 signal edge 0 = increment if a transition from low to high takes place on the cntr1 pin 1 = increment if a transition from high to low takes place on the cntr1 pin 6.1.18 bank1 r8 (prd1h: most significant byte (bit 9 ~ bit 2) of pwm1 time period) the content of bank 1 r8 is the time per iod (time base) of pwm1. the frequency of pwm1 is the reverse of the period. 6.1.19 bank1 r9 (prd2h: most significant byte (bit 9 ~ bit 2) of pwm2 time period) the content of bank 1 r9 is the time per iod (time base) of pwm2. the frequency of pwm2 is the reverse of the period. 6.1.20 bank1 ra (prd3h: most signifi cant byte (bit 9 ~ bit 2) of pwm3 time period) the content of bank 1 ra is the time per iod (time base) of pwm3. the frequency of pwm3 is the reverse of the period. www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom product specification (v 1.1) 03.13.2007 ? 17 (this specification is subject to change without further notice) 6.1.21 bank1 rb (prdl: least si gnificant bits of pwm period cycle) bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 ?0? ?0? prd3[1] prd3[0] prd2 [1] prd2[0] prd1[1] prd1[0] bit 7 & bit 6: unimplemented, read as ?0?. bit 5 & bit 4 (prd3[1], prd3[0]): least significant bits of pwm3 period cycle. bit 3 & bit 2 (prd2[1], prd2[0]): least significant bits of pwm2 period cycle. sectioning actions refer to the reset descri ption. the following actions refer to the section status operation. bit 1 & bit 0 (prd1[1], prd1[0]): least significant bits of pwm1 period cycle. 6.1.22 bank 1 rc (dt1h: most signi ficant byte (bit 9 ~ bit 2) of pwm1 duty cycle) a specified value keeps the output of pwm1 to remain high until the value matches with tmr1. 6.1.23 bank 1 rd (dt2h: most signi ficant byte (bit 9 ~ bit 2) of pwm2 duty cycle) a specified value keeps the output of pwm2 to remain high until the value matches with tmr2. 6.1.24 bank1 re (dt3h: most signi ficant byte (bit 9 ~ bit 2) of pwm3 duty cycle) a specified value keeps the output of pwm3 to remain high until the value matches with tmr3. 6.1.25 bank1 rf (dtl: least signifi cant bits of pwm duty cycle) bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 ?0? ?0? pwm3[1] pwm3[0] pwm2[1 ] pwm2[0] pwm1[1] pwm1[0] bit 7 & bit 6: unimplemented, read as ?0? bit 5 & bit 4 (pwm3[1], pwm3[0]): least significant bits of pwm3 duty cycle bit 3 & bit 2 (pwm2[1], pwm2[0]): least significant bits of pwm2 duty cycle bit 1 & bit 0 (pwm1[1], pwm1[0]): least significant bits of pwm1 duty cycle www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom 18 ? product specification (v1.1) 03.13.2007 (this specification is subjec t to change without further notice) 6.1.26 bank 2 r6 (bocon: buzze r output control register) bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 ten tck1 tck0 fscs ?0? ?0? ?0? ?0? bit 4 (fscs): high or low frequency select in function operating 0 = high 1 = low bit 5~bit 6 (tck0~tck1): keytone output clock source select clock source keytone output frequency normal tck1 tck0 fscs=0 fscs=1 slow, idle fc=8m fs=32.768k 0 0 fc/(2 13 ) fs/(2 5 ) fs/(2 5 ) 0.976khz 1.024khz 0 1 fc/(2 12 ) fs/(2 4 ) fs/(2 4 ) 1.953khz 2.048khz 1 0 fc/(2 11 ) fs/(2 3 ) fs/(2 3 ) 3.906khz 4.096khz 1 1 fc/(2 10 ) fs/(2 2 ) fs/(2 2 ) 7.812khz 8.192khz bit 7 (ten): keytone enable control. 0 = disable 1 = enable mux fc/2 12 fc/2 11 fc/2 10 fs/2 4 fs/2 3 , , fc/2 13 fs/2 5 , fs/2 , 2 tck 2 tbktc data output output latch d q output enable /bo pin ten fig. 6-2 buzzer output pin configuration keytone output can generate 50% duty pulse for driving a piezo-electric buzzer. the p83 must be set to ?1? before the keytone is enabled, it can be halted by setting p83 to ?0?. www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom product specification (v 1.1) 03.13.2007 ? 19 (this specification is subject to change without further notice) p83/bo pin ten p83/bo pin fig. 6-3 tone output pin timing chart bit 3 ~ bit 0: unimplemented, read as ?0? 6.1.27 bank 2 r7 (system control register) bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 t1s t2s t3s ?0? ?0? ?0? ?0? idle bit 7: timer 1 clock source 0 = timer 1 source is used as main clock 1 = timer 1 source is used as sub clock bit 6: timer 2 clock source 0 = timer 2 source is used as main clock 1 = timer 2 source is used as sub clock bit 5: timer 3 clock source 0 = timer 3 source is used as main clock 1 = timer 3 source is used as sub clock bit 4 ~ bit 1: unimplemented, read as ?0? bit 0 (idle) : select idle mode or sleep mode idle = ?0? + slep instruction: sub-oscillator (fs), fs = 32.768khz (idle mode). in idle mode, only the sub-oscillator acting as timer 1, 2, 3 sources, and cpu is halted. idle = ?1?+slep instruction: all os cillation stop (sleep mode). in this mode, main-oscillator (fm) and fs is not work simultaneously. idle = ?0? + slep instruction idle mode idle = ?1? + slep instruction sleep mode nop instruction must be added after sleep instruction. www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom 20 ? product specification (v1.1) 03.13.2007 (this specification is subjec t to change without further notice) example: idle mode: idle bit = ?0 ? + slep instruction + nop instruction sleep mode: idle bit = ?1? + slep instruction + nop instruction. only the normal can entering sleep mode, id le mode can?t entering the sleep mode. idle = "0"+slep timer must select low crystal source in normal mode normal mode sleep mode idle mode wake-up pin change or timer interrupt or ad or comparator idle = "1"+slep wake-up all wake-up function except pwm fig. 6-4 cpu operation mode in sleep mode, the internal oscillator is turned off and all system operation is halted. sleep mode is released by /sleep pin (level sensitive or edge sensitive). after warm-up period, the next instruction will be executed which is after the sleep mode start instruction. sleep mode can also be released by setting the /reset pin to low and executing a reset operation. in idle mode, only the low crystal source exis tence, the others crystal source were off. only the timer (tcc, timer 1, timer 2, ti mer 3, pwm 1, pwm 2, pwm 3) can work normally when its clock source select low crystal (if clock source select high crystal, timer will not work). if timer set the pwmw e as ?1?, when the timer or pwm occurs interrupt will wake up the cpu and entering normal mode. the tcc overflow will not wake up cpu. 6.1.28 bank 2 r8 (aisr: adc input select register) the aisr register defines the pins of port 6 as analog inputs or as digital i/o, individually. bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 ade7 ade6 ade5 ade4 ade3 ade2 ade1 ade0 bit 7 (ade7): ad converter enable bit of p67 pin 0 = disable ain7, p67 functions as i/o pin 1 = enable ain7, to function as analog input pin bit 6 (ade6): ad converter enable bit of p66 pin 0 = disable ain6, p66 functions as i/o pin 1 = enable ain6, to function as analog input pin www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom product specification (v 1.1) 03.13.2007 ? 21 (this specification is subject to change without further notice) bit 5 (ade5): ad converter enable bit of p65 pin 0 = disable ain5, p65 functions as i/o pin 1 = enable ain5, to function as analog input pin bit 4 (ade4): ad converter enable bit of p64 pin 0 = disable ain4, p64 functions as i/o pin 1 = enable ain4 to function as analog input pin bit 3 (ade3): ad converter enable bit of p63 pin 0 = disable ain3, p63 functions as i/o pin 1 = enable ain3, to function as analog input pin bit 2 (ade2): ad converter enable bit of p62 pin 0 = disable ain2, p62 functions as i/o pin 1 = enable ain2, to function as analog input pin bit 1 (ade1): ad converter enable bit of p61 pin 0 = disable ain1, p61 functions as i/o pin 1 = enable ain1, to function as analog input pin bit 0 (ade0): ad converter enable bit of p60 pin. 0 = disable ain0, p60 functions as i/o pin 1 = enable ain0, to function as analog input pin note the p60/ain0 pin priority is as follows: 6.1.29 bank 2 r9 (adcon: adc control register) bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 vrefs ckr1 ckr0 adrun adpd adis2 adis1 adis0 bit 7 (vrefs): the input source of the vref of the adc 0 = the vref of the adc is connected to vdd (default value), and the p84/vref pin carries out the function of p84 1 = the vref of the adc is connected to p84/vref note the p84/vref pin priority is as follows: p60/ade0 priority high low ain0 p60 p84/vref pin priority high low vref p84 www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom 22 ? product specification (v1.1) 03.13.2007 (this specification is subjec t to change without further notice) bit 6 & bit 5 (ckr1 & ckr0): the prescaler of adc oscillator clock rate 00 = 1 : 16 (default value) 01 = 1 : 4 10 = 1 : 64 11 = 1 : wdt ring oscillator frequency ckr1:ckr0 operation mode max. operation frequency 00 fosc/16 4 mhz 01 fosc/4 1 mhz 10 fosc/64 16mhz 11 internal rc - bit 4 (adrun): adc starts to run. 0 = reset upon completion of the conversion. this bit cannot be reset through software 1 = an ad conversion is started. this bit can be set by software bit 3 (adpd): adc power-down mode 0 = switch off the resistor reference to save power even while the cpu is operating 1 = adc is operating bit 2 ~ bit 0 (adis2 ~adis0): analog input select 000 = ain0/p60 001 = ain1/p61 010 = ain2/p62 011 = ain3/p63 100 = ain4/p64 101 = ain5/p65 110 = ain6/p66 111 = ain7/p67 these bits can only be changed when the adif bit (see section 6.1.14) and the adrun bit are both low. 6.1.30 bank 2 ra (adoc: adc o ffset calibration register) bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 cali sign vof[2] vof[1] vof[0] ?0? ?0? ?0? bit 7 (cali): calibration enable bit for adc offset 0 = disable calibration 1 = enable calibration www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom product specification (v 1.1) 03.13.2007 ? 23 (this specification is subject to change without further notice) bit 6 (sign): polarity bit of offset voltage 0 = negative voltage 1 = positive voltage bit 5 ~ bit 3 (vof [2] ~ vof [0]): offset voltage bits vof[2] vof[1] vof[0] EM78P330N 0 0 0 0lsb 0 0 1 2lsb 0 1 0 4lsb 0 1 1 6lsb 1 0 0 8lsb 1 0 1 10lsb 1 1 0 12lsb 1 1 1 14lsb bit 2 ~ bit 0: unimplemented, read as ?0? 6.1.31 bank 2 rb (addata: converted value of adc) bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 ad11 ad10 ad9 ad8 ad7 ad6 ad5 ad4 when the ad conversion is completed, t he result is loaded into the addata. the adrun bit is cleared, and the adif (see section 6.1.14) is set. rb is read only. 6.1.32 bank 2 rc (addata1h: converted value of adc) bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 ?0? ?0? ?0? ?0? ad11 ad10 ad9 ad8 when the ad conversion is completed, t he result is loaded into the addata1h. the adrun bit is cleared, and the adif (see section 6.1.14) is set. rc is read only. 6.1.33 bank 2 rd (addata1l: converted value of adc) bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 ad7 ad6 ad5 ad4 ad3 ad2 ad1 ad0 when the ad conversion is completed, t he result is loaded into the addata1l. the adrun bit is cleared, and the adif (see section 6.1.14) is set. rd is read only www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom 24 ? product specification (v1.1) 03.13.2007 (this specification is subjec t to change without further notice) 6.1.34 bank 2 re (lvdc: lvd control register ) bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 ?0? ?0? ?0? ?0? lvden /lvd lvd1 lvd0 there is no lvd function in the ice330n simulator. bits 7 ~ 4: not used, set to ?0? at all time. bit 3 (lvden): low voltage detect register 0 : disable lvd 1 : enable lvd bit 2 (/lvd): low voltage detector. this is a read only bit. when the vdd pin voltage is lower than the lvd voltage interrupt level (selected by lvd1 and lvd0), this bit will be cleared. 0 : if vdd < .lvd voltage interrupt level 1 : if vdd > lvd voltage interrupt level bits 1 ~ 0 (lvd1 ~ lvd0): low voltage detect level select bits lvden lvd1, lvd0 lvd voltage interrupt level lvdif 1 11 2.2v 1* 1 10 3.3v 1* 1 01 4.0v 1* 1 00 4.5v 1* 0 xx na 0 * if vdd has crossover at lvd voltage interrupt level as vdd changes, lvdif =1. 6.1.35 bank 2 rf (tmr3h: most signi ficant bits (bit 9 ~ bit 2) of pwm3 timer) the contents of rf are read-only. 6.1.36 bank3 r5 (pull-low control register 1) bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 /pl57 /pl56 /pl55 /pl54 /pl53 /pl52 /pl51 /pl50 bank 3 r5 register is both readable and writable. bit 7 (/pl57): control bit used to enable the pull-high of the p57 pin. 0 = enable pull-low output 1 = disable pull-low output bit 6 (/pl56): control bit used to enable the pull-low function of the p56 output pin. bit 5 (/pl55): control bit used to enable the pull-lo w function of the p55 output pin. bit 4 (/pl54): control bit used to enable the pull-low function of the p54 output pin. bit 3 (/pl53): control bit used to enable the pull-low function of the p53 output pin. www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom product specification (v 1.1) 03.13.2007 ? 25 (this specification is subject to change without further notice) bit 2 (/pl52): control bit used to enable the pull-low function of the p52 output pin. bit 1 (/pl51): control bit used to enable the pull-low function of the p51 output pin. bit 0 (/pl50): control bit used to enable the pull-low function of the p50 output pin. 6.1.37 bank 3 r6 (pull-low control register 2) bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 /pl67 /pl66 /pl65 /pl64 /pl63 /pl62 /pl61 /pl60 bank 3 r6 register is both readable and writable. bit 7 (/pl67): control bit used to enable the pull-high of the p67 pin. 0 = enable pull-low output 1 = disable pull-low output bit 6 (/pl66): control bit used to enable the pull-low function of the p66 output pin. bit 5 (/pl65): control bit used to enable the pull-lo w function of the p65 output pin. bit 4 (/pl64): control bit used to enable the pull-low function of the p64 output pin. bit 3 (/pl63): control bit used to enable the pull-low function of the p63 output pin. bit 2 (/pl62): control bit used to enable the pull-low function of the p62 output pin. bit 1 (/pl61): control bit used to enable the pull-low of function the p61 output pin. bit 0 (/pl60): control bit used to enable the pull-low of function the p60 output pin. 6.1.38 bank3 r7 (pull-low control register 3) bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 /pl77 /pl76 /pl75 /pl74 /pl73 /pl72 /pl71 /pl70 bank 3 r7 register is both readable and writable. bit 7 (/pl77): control bit used to enable the pull-high of the p77 pin. 0 = enable pull-low output 1 = disable pull-low output bit 6 (/pl76): control bit used to enable the pull-low function of the p76 output pin. bit 5 (/pl75): control bit used to enable the pull-lo w function of the p75 output pin. bit 4 (/pl74): control bit used to enable the pull-low function of the p74 output pin. bit 3 (/pl73): control bit used to enable the pull-low function of the p73 output pin. bit 2 (/pl72): control bit used to enable the pull-low function of the p72 output pin. bit 1 (/pl71): control bit used to enable the pull-low function of the p71 output pin. bit 0 (/pl70): control bit used to enable the pull-low function of the p70 output pin. www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom 26 ? product specification (v1.1) 03.13.2007 (this specification is subjec t to change without further notice) 6.1.39 bank3 r8 (pull-low control register 4) bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 ?0? ?0? ?0? /pl84 /pl83 /pl82 /pl81 /pl80 bank 3 r8 register is both readable and writable. bits 7 ~ 5: not used, set ?0? at all time. bit 4 (/pl84): control bit used to enable the pull-high function of the p84 output pin. 0 = enable pull-low output 1 = disable pull-low output bit 3 (/pl83): control bit used to enable the pull-low function of the p83 output pin. bit 2 (/pl82): control bit used to enable the pull-lo w function of the p82 output pin. bit 1 (/pl81): control bit used to enable the pull-low function of the p81 output pin. bit 0 (/pl80): control bit used to enable the pull-low function of the p80 output pin. 6.1.40 bank3 r9 (pull-hi gh control register 1) bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 /ph57 /ph56 /ph55 /ph54 /ph53 /ph52 /ph51 /ph50 bank 3 r9 register is both readable and writable. bit 7 (/ph57): control bit used to enable the pull-high function of the p57 output pin. 0 = enable pull-high output 1 = disable pull-high output bit 6 (/ph56): control bit used to enable the pull-high function of the p56 output pin. bit 5 (/ph55): control bit used to enable the pull-hi gh function of the p55 output pin. bit 4 (/ph54): control bit used to enable the pull-high function of the p54 output pin. bit 3 (/ph53): control bit used to enable the pull-high function of the p53 output pin. bit 2 (/ph52): control bit used to enable the pull-high function of the p52 output pin. bit 1 (/ph51): control bit used to enable the pull-high function of the p51 output pin. bit 0 (/ph50): control bit used to enable the pull-high function of the p50 output pin. 6.1.41 bank 3 ra (pull-hi gh control register 2) bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 /ph67 /ph66 /ph65 /ph64 /ph63 /ph62 /ph61 /ph60 bank 3 ra register is both readable and writable. bit 7 (/ph67): control bit used to enable the pull-high of the p67 pin. 0 = enable pull-high output 1 = disable pull-high output www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom product specification (v 1.1) 03.13.2007 ? 27 (this specification is subject to change without further notice) bit 6 (/ph66): control bit used to enable the pull-high function of the p66 output pin. bit 5 (/ph65): control bit used to enable the pull-hi gh function of the p65 output pin. bit 4 (/ph64): control bit used to enable the pull-high function of the p64 output pin. bit 3 (/ph63): control bit used to enable the pull-high function of the p63 output pin. bit 2 (/ph62): control bit used to enable the pull-high function of the p62 output pin. bit 1 (/ph61): control bit used to enable the pull-high function of the p61 output pin. bit 0 (/ph60): control bit used to enable the pull-high function of the p60 output pin. 6.1.42 bank 3 rb (pull-hi gh control register 3) bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 /ph77 /ph76 /ph75 /ph74 /ph73 /ph72 /ph71 /ph70 bank 3 rb register is both readable and writable. bit 7 (/ph77): control bit used to enable the pull-high function of the p77 output pin. 0 = enable pull-high output 1 = disable pull-high output bit 6 (/ph76): control bit used to enable the pull-high function of the p76 output pin. bit 5 (/ph75): control bit used to enable the pull-hi gh function of the p75 output pin. bit 4 (/ph74): control bit used to enable the pull-high function of the p74 output pin. bit 3 (/ph73): control bit used to enable the pull-high function of the p73 output pin. bit 2 (/ph72): control bit used to enable the pull-high function of the p72 output pin. bit 1 (/ph71): control bit used to enable the pull-high function of the p71 output pin. bit 0 (/ph70): control bit used to enable the pull-high function of the p70 output pin. 6.1.43 bank 3 rc (pull-hi gh control register 4) bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 ?0? ?0? ?0? /ph84 /ph83 /ph82 /ph81 /ph80 bank 3 rc register is both readable and writable. bits 7 ~ 5: not used, set to ?0? at all time. bit 4 (/ph84): control bit used to enable the pull-high function of the p84 output pin. 0 = enable pull-low output 1 = disable pull-low output bit 3 (/ph83): control bit used to enable the pull-high function of the p83 output pin. bit 2 (/ph82): control bit used to enable the pull-lo w function of the p82 output pin. www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom 28 ? product specification (v1.1) 03.13.2007 (this specification is subjec t to change without further notice) bit 1 (/ph81): control bit used to enable the pull-low function of the p81 output pin. bit 0 (/ph80): control bit used to enable the pull-low function of the p80 output pin. 6.1.44 bank 3 rd (tmr1h: most si gnificant bits (bit9 ~ bit2) of pwm1 timer) the contents of rd are read-only. 6.1.45 bank 3 re (tmr2h: most signi ficant bits (bit 9 ~ bit 2) of pwm2 timer) the contents of re are read-only. 6.1.46 bank 3 rf (tmrl: least significant bits of pwm timer) bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 ?0? ?0? tmr3[1] tmr3[0] tmr2[1 ] tmr2[0] tmr1[1] tmr1[0] the contents of rf are read only, bit 7 ~ bit 6: unimplemented, read as ?0?. bit 5 ~ bit 4: (tmr3 [1], tmr3 [0]): most significant bits of pwm3 timer. bit 3 ~ bit 2: (tmr2 [1], tmr2 [0]): most significant bits of pwm2 timer. bit 1 ~ bit 0: (tmr1 [1], tmr1 [0]): most significant bits of pwm1 timer. 6.2 special purpose registers 6.2.1 a (accumulator) internal data transfer operation, or inst ruction operand holding usually involves the temporary storage function of the accumulator. the accumulator is not an addressable register. 6.2.2 cont (control register) bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 inte int ts te pste pst2 pst1 pst0 bit 7 (inte): int signal edge 0 = interrupt occurs at the rising edge on the int pin 1 = interrupt occurs at the falling edge on the int pin bit 6 (int): interrupt enable flag 0 = masked by disi or hardware interrupt 1 = enabled by the eni/reti instructions this bit is readable only. bit 5 (ts): tcc signal source 0 = internal instruction cycle clock. if p56 is used as i/o pin, ts must be 0. 1 = transition on the tcc pin www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom product specification (v 1.1) 03.13.2007 ? 29 (this specification is subject to change without further notice) bit 4 (te): tcc signal edge 0 = increment if the transition from low to high takes place on the tcc pin 1 = increment if the transition from high to low takes place on the tcc pin. bit 3 (pste): prescaler enable bit for tcc 0 = prescaler disable bit. tcc rate is 1:1 1 = prescaler enable bit. tcc rate is set as bit 2 ~ bit 0. bit 2 ~ bit 0 (pst2 ~ pst0): tcc prescaler bits pst2 pst1 pst0 tcc rate 0 0 0 1:2 0 0 1 1:4 0 1 0 1:8 0 1 1 1:16 1 0 0 1:32 1 0 1 1:64 1 1 0 1:128 1 1 1 1:256 note: tcc time-out period [1/fosc x prescaler x 256 (tcc cnt) x 1 (clk=2)] tcc time-out period [1/fosc x prescaler x 256 (tcc cnt) x 2 (clk=4)] 6.2.3 ioc5 ~ ioc8 (i/o port control register) 0 = defines the relative i/o pin as outpu 1 = puts the relative i/o pin into high impedance ioc5, ioc6, ioc7, and ioc8 registers are all readable and writable. 6.2.4 ioc9 (t4con: time r 4 control register) bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 spie spif ? tm4if ?0? tm4e tm4p1 tm4p0 bit 7(spiie): spi interrupt enable bit 0 = disable spi interrupt 1 = enable spi interrupt bit 6 (spiif): spi interrupt flag. set by data transmission complete, flag is cleared by software. bit 4 (tm4if) timer 4 interrupt flag. set by the comparator during timer 4 application, flag is cleared by software. bit 3: unimplemented, read as ?0? bit 2 (tm4e) : timer 4 function enable bit 0 = disable timer 4 function as default 1 = enable timer 4 function www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom 30 ? product specification (v1.1) 03.13.2007 (this specification is subjec t to change without further notice) bit 1~bit 0 (tm4p) : timer4 prescaler bit tm4p1 tm4p0 prescaler rate 0 0 1:1 0 1 1:4 1 0 1:8 1 1 1:16 6.2.5 ioca (tcmpcon: comparator control register) bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 ?0? ?0? ?0? cmpif cmpie cpout cos1 cos0 bits 7~ 5: unimplemented, read as ?0? bit 4 (cmpif): comparator interrupt flag. set w hen a change occurs in the output of comparator. reset by software. bit 3 (cmpie): cmpif interrupt enable bit 0 = disable cmpif interrupt 1 = enable cmpif interrupt when the comparator output status change is used to enter interrupt vector or to enter next instruction, the cmpie bit must be set to ?enable?. bit 2 (cpout): the result of the comparator output bit 1 ~ bit 0 (cos1 ~ cos0): comparator/op select bits cos1 cos0 function description 0 0 the comparator and op arenot used. p56 functions as normal i/o pin 0 1 functions as comparator and p56 functions as normal i/o pin 1 0 functions as comparator and p56 functions as comparator output pin (co) 1 1 functions as op and p56 func tions as op output pin (co) 6.2.6 ioce (wdt control register) bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 wdte eis0 eis1 psw e psw2 psw1 psw0 lvdie bit 7 (wdte): control bit used to enable the watchdog timer 0 = disable wdt 1 = enable wdt wdte is both readable and writable. bit 6 (eis0): control bit used to define the function of the p52 (/int0) pin 0 = p52, normal i/o pin 1 = /int0, external interrupt pin. in this case, the i/o control bit of p52 (bit 2 of ioc50) must be set to "1", and tied to a pull-high register (75 k ? ) www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom product specification (v 1.1) 03.13.2007 ? 31 (this specification is subject to change without further notice) note when eis0 is "0," the path of /int0 is masked . when eis0 is "1," the status of /int0 pin can also be read by way of reading port 5 (r5). refer to fig. 6-4 (i/o port and i/o control register circuit for p52 ( /int0)) under section 6.4 (i/o ports). eis0 is both readable and writable. bit 5 (eis1): control bit used to define the function of the p53 (/int1) pin 0 = p53, normal i/o pin 1 = /int1, external interrupt pin. in this case, the i/o control bit of p53 (bit 3 of ioc50) must be set to "1", and tied to a pull-high register (75 k ? ). note when eis1 is "0," the path of /int1 is masked . when eis1 is "1," the status of /int1 pin can also be read by way of reading port 5 (r5). refer to fig. 6-4 (i/o port and i/o control register circuit for p53 ( /int1)) under section 6.4 (i/o ports). eis1 is both readable and writable. bit 4 (pswe): prescaler enable bit for wdt 0 = prescaler disable bit. wdt rate is 1:1 1 = prescaler enable bit. wdt rate is set as bit 4~bit 2 bit 3 ~ bit 1 (psw2 ~ psw0): wdt prescaler bits. psw2 psw1 psw0 wdt rate 0 0 0 1:2 0 0 1 1:4 0 1 0 1:8 0 1 1 1:16 1 0 0 1:32 1 0 1 1:64 1 1 0 1:128 1 1 1 1:256 bit 0 (lvdie) lvdif interrupt enable bit. 0 = disable lvdif interrupt 1 = enable lvdif interrupt www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom 32 ? product specification (v1.1) 03.13.2007 (this specification is subjec t to change without further notice) 6.2.7 iocf (interrupt mask register) bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 pwm3ie pwm2ie pwm1ie adie exie1 exie0 icie tcie note iocf register is both readable and writable individual interrupt is enabled by setting its associated control bit in the iocf to "1. " global interrupt is enabled by the eni instruction and is disabled by the disi instruction. refer to fig. 6-19 (interrupt i nput circuit) under secti on 6.6 (interrupt). bit 7 (pwm3ie): pwm3if interrupt enable bit 0 = disable pwm3 interrupt 1 = enable pwm3 interrupt bit 6 (pwm2ie): pwm2if interrupt enable bit 0 = disable pwm2 interrupt 1 = enable pwm2 interrupt bit 5 (pwm1ie): pwm1if interrupt enable bit 0 = disable pwm1 interrupt 1 = enable pwm1 interrupt bit 4 (adie): adif interrupt enable bit 0 = disable adif interrupt 1 = enable adif interrupt when the adc complete status is used to enter an interrupt vector or to enter next instruction, the adie bit must be set to ?enable. ? bit 3 (exie1): exif external 1 interrupt enable bit 0 = disable exif interrupt 1 = enable exif interrupt bit 2 (exie0): exif external 0 interrupt enable bit 0 = disable exif interrupt 1 = enable exif interrupt bit 1 (icie): icif interrupt enable bit 0 = disable icif interrupt 1 = enable icif interrupt if port 6 input status change inte rrupt is used to enter an interrupt vector or to enter next instruction, the icie bit must be set to ?enable?. bit 0 (tcie): tcif interrupt enable bit. 0 = disable tcif interrupt 1 = enable tcif interrupt www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom product specification (v 1.1) 03.13.2007 ? 33 (this specification is subject to change without further notice) 6.3 tcc/wdt and prescaler there are two 8-bit counters available as pr escalers for the tcc and wdt respectively. the pst0 ~ pst2 bits of the cont register are used to determine the ratio of the tcc prescaler, and the pwr0 ~ pwr2 bits of the ioce0 register are used to determine the prescaler of wdt. the prescaler counter is cleared by the instructions each time such instructions are written into tcc. the wdt and prescaler will be cleared by the ?wdtc? and ?slep? instructions. fig. 6- 5 (next page) depicts the block diagram of tcc/wdt. tcc (r1) is an 8-bit timer/counter. the tcc clock source can be an internal clock or external signal input (edge selectable from t he tcc pin). if tcc signal source is from an internal clock, the tcc will be incremented by 1 at every instruction cycle (without prescaler). referring to fig. 6-5, clk=fosc/ 2 or clk=fosc/4 is dependent to the code option bit . clk=fosc/2 if the clks bit is "0," and clk=fosc/4 if the clks bit is "1." if the tcc signal source is from an external clock input, tcc will be incremented by 1 at every falling edge or rising edge of t he tcc pin. the tcc pin input time length (kept in high or low level) must be greater than 1clk. note the internal tcc will stop running when sleep mode occurs. however, during ad conversion, when tcc is set to ?slep? instruct ion, if the adwe bit of re register is enabled, the tcc will keep on running. the watchdog timer is a free running on-chip rc oscillator. the wdt will keep on running even when the oscillator driver has been turned off (i.e., in sleep mode). during normal operation or sleep mode, a wdt time-out (if enabled) will cause the device to reset. the wdt can be enabled or disabled at any time during normal mode through software programming. refer to wdte bit of ioce0 register (section 6.2.10 ioce0 (wdt control register) . with no prescaler, the wdt time-out duration is approximately 18ms. 1 1 vdd=5v, setup time period = 16.5ms 30%. vdd=3v, setup time period = 18ms 30%. www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom 34 ? product specification (v1.1) 03.13.2007 (this specification is subjec t to change without further notice) 8-bit counter wdt prescaler 8 to 1 mux wdt time out wdte (ioce0) tcc pin mux clk (fosc/2 or fosc/4) 8-bit counter 8 to 1 mux te (cont) data bus tcc overflow interrupt ts (cont) sync 2 cycles tcc (r1) 0 1 psw2~0 (ioce0) prescaler psr2~0 (cont) fig. 6-5 tcc and wdt block diagram 6.4 i/o ports the i/o registers (port 5, port 6, port 7 and po rt8) are bidirectional tri-state i/o ports. the pull-high and pull-down functions can be set internally by iocb0, iocc0, and iocd0 respectively. port 6 features an input status change interrupt (or wake-up) function. each i/o pin can be defined as "input" or "output" pin by the i/o control registers (ioc50 ~ ioc80). the i/o regi sters and i/o contro l registers are both readable and writable. the i/o interface circuits for port 5, port 6, and port 7 are illustrated in figures 6-6, 6-7, & 6-8 respec tively (see next page). port 6 with input change interrupt/wake-up is shown in fig. 6-9. www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom product specification (v 1.1) 03.13.2007 ? 35 (this specification is subject to change without further notice) m u x port pcwr pdwr iod pdrd 0 1 pcrd  d d q q q q @ @ $ - $ - 1 3 clk clk 1 3 note: pull-high and open-drain are not shown in the figure. fig. 6-6 i/o port and i/o control register cir cuit for port 5, port 7, and port 8 note: pull-high and open-drain are not shown in the figure. fig. 6-7 i/o port and i/o control register circuit for p52 (/int0) and p53 (/int1) www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom 36 ? product specification (v1.1) 03.13.2007 (this specification is subjec t to change without further notice) pcrd m u x iod 0 1  pdrd p60 ~ p67 pcwr d q q @ clk 1 3 $ - pdwr d q q @ clk 1 3 $ - 1 3 $ - clk dq q @ ti n port note: pull-high (down) and open-drain are not shown in the figure. fig. 6-8 i/o port and i/o control register circuit for port 6 /slep t17 t10 t11 ioce.1 interrupt eni instruction disi instruction interrupt (wake-up from sleep) next instruction (wake-up from sleep) clk clk clk q q q q q q _ _ _ d d d p p p l l l r r r c c c re.1 fig. 6-9 port 6 block diagram with input change interrupt/wake-up www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom product specification (v 1.1) 03.13.2007 ? 37 (this specification is subject to change without further notice) 6.4.1 usage of port 6 input ch ange wake-up/interrupt function (1) wake-up (2) wake-up and interrupt (a) before sleep (a) before sleep 1. disable wdt 1. disable wdt 2. read i/o port 6 (mov r6,r6) 2. read i/o port 6 (mov r6,r6) 3. execute "eni" or "disi" 3. execute "eni" or "disi" 4. enable wake-up bi t (set re icwe =1) 4. enable wake-up bit (set re icwe =1) 5. execute "slep" instruction 5. enable interrupt (set iocf icie =1) (b) after wake-up 6. execute "slep" instruction next instruction (b) after wake-up 1. if "eni" interrupt vector (008h) 2. if "disi" next instruction (3) interrupt (a) before port 6 pin change 1. read i/o port 6 (mov r6,r6) 2. execute "eni" or "disi" 3. enable interrupt (set iocf icie =1) (b) after port 6 pin changed (interrupt) 1. if "eni" interrupt vector (008h) 2. if "disi" next instruction 6.5 serial peripheral interface mode 6.5.1 overview and features overview: figures 6-10, 6-11, and 6-12 shows how the EM78P330N communicates with other devices through spi module. if the em78p330 n is a master controller, it sends clock through the sck pin. a couple of 8-bit data are transmitted and received at the same time. however, if EM78P330N is defined as a slave, its sck pin could be programmed as an input pin. data will continue to be shifted based on both the clock rate and the selected edge. the spis bit 7 (dord) can also be set to determine the spi transmission order, spic bit 3 (sdoc) to control sdo pin after serial data output status and spis bit 6 (td1), bit 5 (td0) dete rmines the sdo status output delay times. features: ? operation in either master mode or slave mode ? three-wire or four-wire full duplex synchronous communication ? programmable baud rates of communication, ? programming the clock polarity, (rd bit 7) ? interrupt flag available for the read buffer full, www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom 38 ? product specification (v1.1) 03.13.2007 (this specification is subjec t to change without further notice) ? spi transmission order ? after serial data output sdo status select ? sdo status output delay times ? up to 8 mhz (maximum) bit frequency, spi module sck spir reg sdi spiw reg spis reg /ss slave device sdo bit 7 spi module spir reg spiw reg spis reg master device spi module sck spir reg sdi spiw reg spis reg /ss slave device sdo bit 7 spi module spir reg spiw reg spis reg master device spiw reg spiw reg spiw reg spiw reg spir reg fig. 6-10 spi master/slave communication sdi sdo sck /ss p50 p51 p52 p53 mast er slave device 1 slave device 2 slave device 3 slave device 4 vdd sdo sdi sck /ss sdo sdi sck /ss sdo sdi sck /ss sdo sdi sck /ss fig. 6-11 spi configuration of single-master and multi-slave www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom product specification (v 1.1) 03.13.2007 ? 39 (this specification is subject to change without further notice) or slave 1 slave 2 for master 1 slave 3 for master 1,2 slave 4 for master 1,2 slave 5 for master 2 or slave 6 sdi sdo sck /ss sdi sdo sck /ss p50 p51 p52 p53 p50 p51 p52 p53 sdo sdi sck /ss sdo sdi sck /ss sdo sdi sck /ss sdo sdi sck /ss master 1 master 2 fig. 6-12 spi configuration of single-master and multi-slave 6.5.2 spi function description fig. 6-13 spi block diagram www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom 40 ? product specification (v1.1) 03.13.2007 (this specification is subjec t to change without further notice) spi mode select register 8-1 mux 2 1 0 spic spi write register (0x0b) 7~0 spiwb spi shift buffer spi read register (0x0a) data bus fosc 1 0 t4con 6 4 spic 4 spis spic spi 7 2 intc 7~0 spirb sdo sdi /ss shift clock 0 fig. 6-14 spi transmission function block diagram below are the functions of each block and explanations on how to carry out the spi communication with the signals depicted in fig.6-15 and fig.6-16: ? p82/sin: serial data in ? p81/sout: serial data out ? p80/sck: serial clock ? p75//ss: /slave select (option). this pin (/ss) may be required in slave mode. ? rbf: set by buffer full dete ctor, and read spirb to reset. ? buffer full detector: sets to 1 when an 8-bit shifting is completed. ? sse: loads the data in spis register, and begin to shift ? spis reg.: shifting byte in and out. the msb is shifted first. both the spis and the spiw registers are loaded at the same time . once data are written, spis starts transmission/reception. the data received will be moved to the spir register as the shifting of the 8-bit data is completed. the rbf (read buffer full) flag and the spif (spi interrupt) flag are then set. ? spir reg.: read buffer. the buffer will be updated as the 8-bit shifting is completed. the data must be read before the next reception is completed. the rbf flag is cleared as the spir register reads. ? spiw reg.: write buffer. the buffer will ignore any attempts to write until the 8-bit shifting is completed. www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom product specification (v 1.1) 03.13.2007 ? 41 (this specification is subject to change without further notice) the sse bit will be kept in ?1?if the communica tion is still undergoing. this flag must be cleared as the shifting is completed. user s can determine if the next write attempt is available. ? sbrs2~sbrs0: programming the clock frequency/rates and sources. ? clock select: selecting either the internal or the ex ternal clock as the shifting clock. ? edge select: selecting the appropriate clock edges by programming the ces bit 6.5.3 spi signal and pin description the detailed functions of the four pins, sd i, sdo, sck, and /ss, which are shown in fig. 6-20, are as follows: sin/p82: ? serial data in ? receive sequentially, the most significant bit (msb) first, least significant bit (lsb) last. ? defined as high-impedance, if not selected. ? program the same clock rate and clock edge to latch on both the master and slave devices. ? the byte received will update the transmitted byte. ? the rbf bit (located in register 0x0c) will be set as the spi operation is completed. ? timing is shown in fig.6-23 and 6-24. sout/p81: ? serial data out ? transmit sequentially; the most significant bit (msb) first, least significant bit (lsb) last. ? program the same clock rate and clock edge to latch on both the master and slave devices. ? the received byte will update the transmitted byte. ? the ces (located in register 0x0d) bit will be reset, as the spi operation is completed. ? timing is shown in fig.6-21 and 6-22. www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom 42 ? product specification (v1.1) 03.13.2007 (this specification is subjec t to change without further notice) sck/p80 (pin 6): ? serial clock ? generated by a master device ? synchronize the data communication on both the sdi and sdo pins. ? the ces (located in register 0x0d) is used to select the edge to communicate. ? the sbr0~sbr2 (located in register 0x0d) is used to determine the baud rate of communication. ? the ces, sbr0, sbr1, and sbr2 bits have no effect in slave mode ? timing is shown in fig.6-23 and 6-24. /ss/p75 (pin 4): ? slave select; negative logic ? generated by a master device to signify the slave to receive data ? goes low before the first cycle of sck appears, and remains low until the last (eighth) cycle is completed, ? ignores the data on the sdi and sdo pins while /ss is high, since the sdo is no longer driven. ? timing is shown in fig.6-23 and 6-24. 6.5.4 programming the related registers as the spi mode is defined, the related regist ers of this operation are shown in table 2 and table 3. table 1 related control registers of the spi mode address name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 0x0d *spic/rd ces spie sro sse soutc sbr2 sbr1 sbr0 na t4cr/ioc9 spiie spif ? tm4if ?0? tm4e tm4p1 tm4p0 spic: spi control register. bit 7 (ces): clock edge select bit 0 = data shifts out on rising edge, and shifts in on falling edge. data is on hold during the low level. 1 = data shifts out on falling edge, and shifts in on rising edge. data is on hold during the high level. bit 6 (spie): spi enable bit 0 = disable spi mode 1 = enable spi mode www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom product specification (v 1.1) 03.13.2007 ? 43 (this specification is subject to change without further notice) bit 5 (sro): spi read overflow bit 0 = no overflow occurs 1 = a new data is received while the previous data is still being on hold in the spirb register. under this condi tion, the data in spis register will be destroyed. to avoid setting th is bit, users should read the spirb register even if the transmission is implemented only. note this can only occur in slave mode. bit 4 (sse): spi shift enable bit 0 = reset as soon as the shifting is completed and the next byte is ready to shift. 1 = start to shift, and remains on 1 wh ile the current byte continues to transmit. note this bit can be reset by hardware only. bits 2~0 (sbrs): spi baud rate select bits sbrs2 (bit 2) sbrs1 (bit 1) sbrs0 (bit 0) mode baud rate 0 0 0 master fsco/2 0 0 1 master fsco/4 0 1 0 master fsco/8 0 1 1 master fsco/16 1 0 0 master fsco/32 1 0 1 slave /ss enable 1 1 0 slave /ss disable 1 1 1 master tmr4/2 note : in master mode, /ss is disabled. t4cr: timer 4 control register bit 7(spiie): spi interrupt enable bit 0 : disable spi interrupt 1 : enable spi interrupt bit 6 (spiif): spi interrupt flag. set by data tr ansmission complete, flag by software. bit 5 (tm4ie): tm4ie interrupt enable bit 0 : disable tm4ie interrupt 1 : enable tm4ie interrupt bit 3 (tm4if): timer 4 interrupt flag. set by the comparator at timer 4 application, flag is cleared by software. www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom 44 ? product specification (v1.1) 03.13.2007 (this specification is subjec t to change without further notice) bit 3: unimplemented, read as ?0? bit 2 (tm4e) : timer 4 function enable bit 0 : disable timer 4 function (default) 1 : enable timer 4 function bit 1~bit 0 (tm4p) : timer 4 prescaler bit tm4p1 tm4p0 prescaler rate 0 0 1:1 0 1 1:4 1 0 1:8 1 1 1:16 table 2 related status/dat a registers of the spi mode address name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 0x0a spirb/ra srb7 srb6 srb5 srb4 srb3 srb2 srb1 srb0 0x0b spiwb/rb swb7 swb6 swb5 swb4 swb3 swb2 swb1 swb0 0x0c spis/rc dord td1 td0 t4ros od3 od4 - rbf spirb: spi read buffer. once the serial data is received completely, it will load to spirb from spisr. the rbf bit in the spis register will also be set. spiwb: spi write buffer. as a transmitted data is loaded, the spis register stands by and start to shift the data when sensing sck edge with sse set to ?1?. spis: spi status register bit 7 (dord) : data transmission order 0 : shift left (msb first) 1 : shift right (lsb first) bit 6 ~ bit 5: sdo status output delay times options. there is no action in slave mode. td1 td0 delay time 0 0 8 clk 0 1 16 clk 1 0 24 clk 1 1 32 clk bit 4 (t4ros): timer 4 read out buffer select bit 0 : read value from timer 4 preset register 1 : read value from timer 4 counter register bit 3 (od3) open-drain control bit (p81) 0 : open-drain disable for sout 1 : open-drain enable for sout bit 2 (od4) : open drain-control bit (p80) 0 : open-drain disable for sck 1 : open-drain enable for sck www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom product specification (v 1.1) 03.13.2007 ? 45 (this specification is subject to change without further notice) bit 0 (rbf): read buffer full flag 0 : receive is ongoing, spib is empty 1 : receive is completed, spib is full 6.5.5 spi mode timing the edge of sck is selected by programming bit ces. the waveform shown in fig. 6-15 is applicable regardless of whether t he EM78P330N is in master or slave mode with /ss disabled. however, the waveform in fig. 6-16 can only be implemented in slave mode with /ss enabled. fig. 6-15 spi mode with /ss disabled fig. 6-16 spi mode with /ss enable www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom 46 ? product specification (v1.1) 03.13.2007 (this specification is subjec t to change without further notice) 6.5.6 spi software application ;for master spirb == 0x0a spiwb == 0x0b spis == 0x0c rbf == 0 sck_od == 2 sdo_od == 3 td0 == 5 td1 == 6 dord == 7 spic == 0x0d sbrs0 == 0 sbrs1 == 1 sbrs2 == 2 sdoc == 3 sse == 4 sro == 5 spie == 6 ces == 7 tc4cr == 0x09 tm4p0 == 0 tm4p1 == 1 tm4e == 2 tm4if == 4 tm4ie == 5 spif == 6 spie == 7 org 0x00 ; reset vector jmp initial org 0x08 ; spi interrupt vector bank 0 ior tc4cr and a,@0b10111111 iow tc4cr ; clear spi interrupt flag reti org 0x50 initial: mov a,@0x80 ; enable spi interrupt iow tc4cr ; clear spi interrupt flag mov a,@0x55 mov spiwb,a ; transmit data bs spic,spie ; spi shift enable bit bc spis,dord ; shift left bc spis,td0 bc spis,td1 ; sdo status output delay times:8 clocks bc spic,ces ; rising edge bc spic,sbrs0 bc spic,sbrs1 bc spic,sbrs2 ; set baud rate: fc/2 bc spic,sdoc ; sdo output status control bit: high eni ; enable interrupt main: bs spic,sse ; spi start transmit jbc spic,sse jmp $-1 nop nop mov a,@0x55 ; transmit data mov spiwb,a nop nop jmp main www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom product specification (v 1.1) 03.13.2007 ? 47 (this specification is subject to change without further notice) ;for slave port7 == 0x07 spirb == 0x0a spiwb == 0x0b spis == 0x0c rbf == 0 sck_od == 2 sdo_od == 3 td0 == 5 td1 == 6 dord == 7 spic == 0x0d sbrs0 == 0 sbrs1 == 1 sbrs2 == 2 sdoc == 3 sse == 4 sro == 5 spie == 6 ces == 7 ioc7 == 0x07 tc4cr == 0x09 tm4p0 == 0 tm4p1 == 1 tm4e == 2 tm4if == 4 tm4ie == 5 spif == 6 spie == 7 org 0x00 ; reset vector jmp initial org 0x08 ; spi interrupt vector bank 0 ior tc4cr and a,@0b10111111 iow tc4cr ; clear spi interrupt flag reti org 0x50 initial: mov a,@0x00 iow ioc7 ; set port7 as output mov port7,a mov a,@0x80 ; enable spi interrupt iow tc4cr ; clear spi interrupt flag bs spic,spie ; spi shift enable bit bc spis,dord ; shift left bc spis,td0 bc spis,td1 ; sdo status output delay times:8 clocks bc spic,ces ; rising edge bc spis,dord ; shift left bs spic,sbrs0 bc spic,sbrs1 bs spic,sbrs2 ; set baud rate: /ss enable bc spic,sdoc ; sdo output status control bit: high eni mian: bs spic,sse ; spi start transmit jbs spis,rbf ; determine data receive finish jmp $-1 jbc spic,sro ; determine data overflow jmp main mov a,spirb ; receive data mov port7,a nop jmp main www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom 48 ? product specification (v1.1) 03.13.2007 (this specification is subjec t to change without further notice) 6.6 timer 4 6.6.1 overview timer 4 (tmr4) is an 8-bit clock up-counter with a programmable prescaler. when tmr4 is in spi baud rate clock generator mode (sbrs0, sbrs1 and sbrs2 are set to 1) and spi control register bit 4 (sse) is set to 1, ti mer 4 will enable automatically without setting tm4e. tmr4 can be read and written to and cleared on any reset conditions. 6.6.2 function description fig. 6-17 shows timer 4 block diagram. each signal and block is described as follows: osc / 4 tmr4 up-counter set tm4if tm4e overflow set predict value (bank 0-r9) tmr4 value prescaler 1:1~1:16 in spi baud generator mode ? no yes interrupt interrupt and spi clock output t4ros 0 1 fig. 6-17 timer 4 block diagram ? osc/4: input clock. ? prescaler: option 1:1, 1:4, 1: 8, and 1:16 defined by tm4p1 and tm4p2 (t4con<1, 0>). it is cleared when a value is written to tmr4 or t4con, and during any kind of reset as well. ? tmr4: timer 4 register. tmr4 is increm ented until it overflows, and then resets to 0. if it is in the spi baud rate generator m ode, its output is fed as a shifting clock. tmr4 register; increases until it overflows, and then reloads the predicted value. if writing a value to timer 4, the predicted value and tmr4 value will be the set value. however, if t4ros is set to 1 and read value from tmr4, the value will be tmr4 direct value, else t4ros is set to 0 and read value from tmr4, the value will be tmr4 predicted value. www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom product specification (v 1.1) 03.13.2007 ? 49 (this specification is subject to change without further notice) 6.6.3 programming the related registers the related registers of the defined tmr4 operation are shown in table 4 and table 5 table 3 tmr4 related control registers address name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 0x0c spis/rc (bank 0) dord td1 td0 t4ros od3 od4 ? rbf na t4cr/ioc9 spie spif tm4ie tm4if ?0? tm4e tm4p1 tm4p0 table 4 related status/data registers oftmr4 address name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 0x09 tmr4/r9 (bank 0) tmr47 tmr46 tmr45 tmr44 tmr43 tmr42 tmr41 tmr40 na t4cr/ioc9 spie spif ? tm4if ?0? tm4e tm4p1 tm4p0 tmr4: timer 4 register tmr47~tmr40 are set of timer 4 register bits which are incremented until the value matches pwp and then resets to 0. t4ros (bit 4): timer 4 read buffer select bit 0 : read value from timer 4 preset register 1 : read value from timer 4 counter register t4cr: timer 4 control register bit 2 (tm4e): timer4 enable bit bit 1 (tm4p1) and bit 0 (tm4p): timer 4 prescaler for fsco tm4p1 tm4p0 prescaler rate 0 0 1:1 0 1 1:4 1 0 1:8 1 1 1:16 www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom 50 ? product specification (v1.1) 03.13.2007 (this specification is subjec t to change without further notice) 6.7 reset and wake-up 6.7.1 reset and wake-up operation a reset is initiated by one of the following events : 1. power-on reset 2. /reset pin input "low" 3. wdt time-out (if enabled) a device is kept in a reset condition for the duration of approximately 18ms. 2 after the reset is detected. when in lxt mode, the re set time is 500ms. once a reset occurs, the following functions are performed (the initial address is 000h): ? the oscillator continues running, or w ill be started (if in sleep mode). ? the program counter (r2) is set to all "0". ? all i/o port pins are configured as input mode (high-impedance state). ? the watchdog timer and prescaler are cleared. ? when power is switched on, the upper 3 bits of r3 and upper 2 bits of r4 are cleared. ? the cont register bits are set to all "0". executing the ?slep? instruction will asse rt the sleep (power down) mode. while entering sleep mode, the oscillator, tcc, ti mer 1, timer 2, and timer 3 are stopped. the wdt (if enabled) is cleared but keeps on running. the controller can be awakened by: case 1 external reset input on /reset pin case 2 wdt time-out (if enabled) case 3 port 6 input status changes (if icwe is enabled) case 4 comparator output status changes (if cmpwe is enabled) case 5 ad conversion completed (if adwe enable) case 6 pwm/timer overflows (if pwmwe enable) the first two cases (1 & 2) will cause the EM78P330N to reset. the t and p flags of r3 can be used to determine the source of the reset (wake-up). cases 3, 4, & 5 are considered the continuation of program exec ution and the global interrupt ("eni" or "disi" being executed) decides whether or not the controller branches to the interrupt vector following wake-up. if eni is executed before slep, t he instruction will begin to execute from address 0x8 after wake-up. if disi is executed before slep, the execution will restart from the instruction next to slep after wake-up. all sleep mode wake up time is 2ms in high crystal mode. in rc mode (irc or erc), wake-up time is 10 s. in low crystal mode, wake-up time is 500ms. 2 vdd=5v, wdt time-out period = 16.5ms 30%. vdd=3v, wdt time-out period = 18ms 30%. www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom product specification (v 1.1) 03.13.2007 ? 51 (this specification is subject to change without further notice) only one of cases 1 to 5 can be enabled before entering into sleep mode. that is: case [a] if wdt is enabled before slep, all of the re bit is disabled. hence, the EM78P330N can be awakened only with case 1 or case 2. refer to the section on interrupt (section 6.7) for further details. case [b] if port 6 input status change is used to wake -up the EM78P330N and icwe bit of re register is enabled before slep, wdt must be disabled. hence, the EM78P330N can be awakened only with case 3. wake-up time is dependent on oscillator mode. in rc mode the reset time is 32 clocks (for stable oscillators). in high crystal mode, reset time is 2m s and 32 clocks (for stable oscillators); and in low crystal mode, the reset time is 500ms. case [c] if comparator output status change is used to wake-up the EM78P330N and the cmpwe bit of the re register is enabled before slep, wdt must be disabled by software. hence, the EM78P330N can be awakened only with case 4. wake-up time is dependent on oscillator mode. in rc mode, the reset time is 32 clocks (for stable oscillato rs). in high crystal mode, reset time is 2ms and 32 clocks (for stable oscillators), and in low crystal mode, the reset time is 500ms. case [d] if ad conversion completed is used to wake-up the EM78P330N and the adwe bit of the re register is enabl ed before slep, wdt must be disabled by software. hence, the EM78P330N can be awakened only with case 5. the wake-up time is 15 tad (adc clock period). wake-up time is dependent on oscillator mode. in rc mode, the reset time is 32 clocks (for stable oscillato rs). in high crystal mode, reset time is 2ms and 32 clocks (for stable oscillators); and in low crystal mode, the reset time is 500ms. case [e] if pwm/timer output status chang e is used to wake-up the EM78P330N and the pwmwe bit of the re register is enabled before idle mode (except in sleep mode), wdt must be disabled by software. hence, the EM78P330N can be awakening only with case 6. wake-up time is dependent on the oscillator mode. in rc mode the reset time is 32 clocks (for stable oscillators). in high crystal mode, reset time is 2ms and 32 clocks (for stable oscillators); and in low crystal mode, the reset time is 500ms. www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom 52 ? product specification (v1.1) 03.13.2007 (this specification is subjec t to change without further notice) if port 6 input status change interrupt is us ed to wake up the EM78P330N (as in case b above), the following instructio ns must be executed before slep: mov a, @001111xxb ; select wdt prescaler and disable wdt iow ioce0 wdtc ; clear wdt and prescaler mov r6, r6 ; read port 6 eni (or disi) ; enable (or disable) global interrupt mov a, @00000x1xb ; enable port 6 input change wake-up bit mov re mov a, @00000x1xb ; enable port 6 input change interrupt iow iocf slep ; sleep similarly, if the comparator interrupt is used to wake up the EM78P330N (as in case [c] above), the following instructions must be executed before slep: mov a, @xxxxxx10b ; select an comparator and p60 act as co pin iow ioca0 mov a, @001111xxb ; select wdt prescaler and disable wdt iow ioce0 wdtc ; clear wdt and prescaler eni (or disi) ; enable (or disable) global interrupt mov a, @000001xxb ; enable comparator output status change wake-up bit mov re mov a, @xxxx1xxxb ; enable comparator output status change interrupt iow ioca slep ; sleep www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom product specification (v 1.1) 03.13.2007 ? 53 (this specification is subject to change without further notice) 6.7.1.1 wake-up and interrupt mode operation summary all categories under wake-up and interr upt modes are summarized below. signal sleep mode idle mode normal mode disi + iocf (tcie) bit 0 = 1 next instruction+ set rf (tcif) = 1 eni + iocf (tcie) bit 0 = 1 tcc over flow n/a n/a interrupt vector (0x08)+ set rf (tcif) = 1 re (icwe) bit 1 = 0, iocf (icie) bit 1 = 0 re (icwe) bit 1 = 0, iocf (icie) bit 1 = 0 iocf (icie) bit 1 = 0 oscillator, tcc and timerx are stopped. port 6 input status changed wake-up is invalid. oscillator, tcc and timerx are stopped. port 6 input status changed wake-up is invalid. port 6 input status change interrupted is invalid re (icwe) bit 1 = 0, iocf (icie) bit 1 = 1 re (icwe) bit 1 = 0, iocf (icie) bit 1 = 1 set rf (icif) = 1, oscillator, tcc and timerx are stopped. port 6 input status changed wake-up is invalid. set rf (icif) = 1, oscillator, tcc and timerx are stopped. port 6 input status changed wake-up is invalid. re (icwe) bit 1 = 1, iocf (icie) bit 1 = 0 re (icwe) bit 1 = 1, iocf (icie) bit 1 = 0 wake-up+ next instruction oscillator, tcc and timerx are stopped. wake-up+ next instruction oscillator, tcc and timerx are stopped. re (icwe) bit 1 = 1, disi + iocf (icie) bit 1 = 1 re (icwe) bit 1 = 1, disi + iocf (icie) bit 1 = 1 disi + iocf (icie) bit 1 = 1 wake-up+ next instruction+ set rf (icif) = 1 oscillator, tcc and timerx are stopped. wake-up + next instruction + set rf (icif) = 1 oscillator, tcc and timerx are stopped. next instruction + set rf (icif) = 1 re (icwe) bit 1 = 1, eni + iocf (icie) bit 1 = 1 re (icwe) bit1=1, eni + iocf (icie) bit 1 = 1 eni + iocf (icie) bit 1 = 1 port 6 input status change wake-up+ interrupt vector (0x08)+ set rf (icif) = 1 oscillator, tcc and timerx are stopped. wake-up+ interrupt vector (0x08)+ set rf (icif) = 1 oscillator, tcc and timerx are stopped. interrupt vector (0x08)+ set rf (icif) = 1 disi + iocf (exie1, 0) bit 2, 3 = 1 next instruction+ set rf (exif)=1 eni + iocf (exie1, 0) bit 2, 3 = 1 int pin n/a n/a interrupt vector (0x08)+ set rf (exif) = 1 re (adwe) bit 3 = 0, iocf (adie) bit 4 = 0 re (adwe) bit 3 = 0, iocf (adie) bit 4 = 0 iocf (adie) bit 1 = 0 clear bank 1-r9 (adrun)=0, adc is stopped, ad conversion wake-up is invalid. oscillator, tcc and timerx are stopped. clear bank 1-r9 (adrun)=0, adc is stopped, ad conversion wake-up is invalid. oscillator, tcc and timerx are stopped. ad conversion interrupted is invalid re (adwe) bit 3 = 0, iocf (adie) bit 4 = 1 re (adwe) bit 3 = 0, iocf (adie) bit 4 = 1 set rf (adif)=1, bank 1-r9 (adrun) = 0, adc is stoppe d ad conversion wake-up is invalid. oscillator, tcc and timerx are stopped. set rf (adif) = 1, bank 1-r9 (adrun) = 0, adc is stopped, ad conversion wake-up is invalid. oscillator, tcc and timerx are stopped. re (adwe) bit 3 = 1, iocf (adie) bit 4 = 0 re (adwe) bit 3 = 1, iocf (adie) bit 4 = 0 ad conversion wake-up+ next instruction, oscillator, tcc and timerx keep on running. wake-up when adc completed. wake-up+ next instruction, oscillator, tcc and timerx keep on running. wake-up when adc completed. www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom 54 ? product specification (v1.1) 03.13.2007 (this specification is subjec t to change without further notice) signal sleep mode idle mode normal mode re (adwe) bit 3 = 1, disi + iocf (adie) bit 4 = 1 re (adwe) bit 3 = 1, disi + iocf (adie) bit 4 = 1 disi + iocf (adie) bit 4=1 wake-up+ next instruction+ rf (adif) = 1, oscillator, tcc and timerx keep on running. wake-up when adc completed. wake-up+ next instruction+ rf (adif) = 1, oscillator, tcc and timerx keep on running. wake-up when adc completed. next instruction+ rf (adif)=1 re (adwe) bit 3 = 1, eni + iocf (adie) bit 4 = 1 re (adwe) bit 3 = 1, eni + iocf (adie) bit 4 = 1 eni + iocf (adie) bit 4 = 1 ad conversion wake-up+ interrupt vector (0x08)+ rf (adif) = 1, oscillator, tcc and timerx keep on running. wake-up when adc completed. wake-up+ interrupt vector (0x08)+ rf (adif) = 1, oscillator, tcc and timerx keep on running. wake-up when adc completed. interrupt vector (0x08)+ set rf (adif) = 1 re (pwmwe) = 0, ioca (pwmie) bit 0 = 0, if txs = 1 disi + iocf (pwmxie) = 1 only sub-clock oscillate. pwm wake-up is invalid. next instruction+ set rf (pwmxif) = 1 re (pwmwe) = 0, ioca (pwmie) bit 0 = 1, if txs = 1 eni + iocf (pwmxie) = 1 set pwmif = 1 only sub-clock oscillate. pwm wake-up is invalid. re (pwmwe) = 1, ioca (pwmie) bit 0 = 1, if txs = 0 wake-up+ next instruction, only sub-clock oscillate. re (pwmwe) = 1, ioca (pwmie) bit 0 = 1, disi, if txs = 1 wake-up+ next instruction, only sub-clock oscillate. re (pwmwe) = 1, ioca (pwmie) bit 0 = 1, eni, if txs = 1 pwmx (pwm1, pwm2, pwm3) (when timerx matches prdx) n/a wake-up+ interrupt vector (0x08)+ set rf (pwmif) = 1 only sub-clock oscillate. interrupt vector (0x08)+ set rf (pwmxif) = 1 re (cmpwe) bit 2 = 0, ioce (cmpie) bit 0 = 0 re (cmpwe) bit 2 = 0, ioce (cmpie) bit 0 = 0 iocf (cmpie) bit 7 = 0 comparator output status changed wake-up is invalid. oscillator, tcc and timerx are stopped. comparator output status changed wake-up is invalid. oscillator, tcc and timerx are stopped. comparator output status change interrupted is invalid. re (cmpwe) bit 2 = 0, ioce (cmpie) bit 0 = 1 re (cmpwe) bit 2 = 0, ioce (cmpie) bit 0 = 1 set rf (cmpif) = 1, comparator output status changed wake-up is invalid. oscillator, tcc and timerx are stopped. set rf (cmpif) = 1, comparator output status changed wake-up is invalid. oscillator, tcc and timerx are stopped. re (cmpwe) bit 2 = 1, ioce (cmpie) bit 0 = 0 re (cmpwe) bit 2 = 1, ioce (cmpie) bit 0 = 0 wake-up+ next instruction, oscillator, tcc and timerx are stopped. wake-up+ next instruction, oscillator, tcc and timerx are stopped. re (cmpwe) bit 2 = 1, disi + ioce (cmpie) bit 0 = 1 re (cmpwe) bit 2 = 1, disi + ioce (cmpie) bit 0 = 1 disi + ioce (cmpie) bit 0 = 1 wake-up+ next instruction+ set rf (cmpif) = 1, oscillator, tcc and timerx are stopped. wake-up+ next instruction+ set rf (cmpif) = 1, oscillator, tcc and timerx are stopped. next instruction+ set rf (cmpif) = 1 re (cmpwe) bit 2 = 1, eni + ioce (cmpie) bit 0 = 1 re (cmpwe) bit 2 = 1, eni + ioce (cmpie) bit 0 = 1 eni + ioce (cmpie) bit 0 = 1 comparator (comparator output status change) wake-up+ interrupt vector (0x08)+ set rf (cmpif) = 1, oscillator, tcc and timerx are stopped. wake-up+ interrupt vector (0x08)+ set rf (cmpif) = 1, oscillator, tcc and timerx are stopped. interrupt vector (0x08)+ set rf (cmpif) = 1 wdt time out ioce (wdte) bit 7 = 1 wake-up+ reset (address 0x00) wake-up+ reset (address 0x00) reset (address 0x00) www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom product specification (v 1.1) 03.13.2007 ? 55 (this specification is subject to change without further notice) 6.7.1.2 register initial values after reset the following summarizes the registers initialized values. address name reset type bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 bit name c57 c56 c55 c54 c53 c52 c51 c50 power-on 1 1 1 1 1 1 1 1 /reset & wdt 1 1 1 1 1 1 1 1 n/a ioc5 wake-up from pin change p p p p p p p p bit name c67 c66 c65 c64 c63 c62 c61 c60 power-on 1 1 1 1 1 1 1 1 /reset & wdt 1 1 1 1 1 1 1 1 n/a ioc6 wake-up from pin change p p p p p p p p bit name c77 c76 c75 c74 c73 c72 c71 c70 power-on 1 1 1 1 1 1 1 1 /reset & wdt 1 1 1 1 1 1 1 1 n/a ioc7 wake-up from pin change p p p p p p p p bit name - - - c84 c83 c82 c81 c80 power-on 0 0 0 1 1 1 1 1 /reset &wdt 0 0 0 1 1 1 1 1 n/a ioc8 wake-up from pin change p p p p p p p p bit name spie spif - tm4if - tm4e tm4p1 tm4p0 power-on 0 0 0 0 0 0 0 0 /reset & wdt 0 0 0 0 0 0 0 0 n/a ioc9 (t4cr) wake-up from pin change p p p p p p p p bit name - - - cmpif cmpie cpout cos1 cos0 power-on 0 0 0 0 0 0 0 0 /reset & wdt 0 0 0 0 0 0 0 0 n/a ioca (cmpcon) wake-up from pin change p p p p p p p p bit name - - - - - - - - power-on 1 1 1 1 1 1 1 1 /reset & wdt 1 1 1 1 1 1 1 1 n/a iocc wake-up from pin change p p p p p p p p bit name - - - - - - - - power-on 1 1 1 1 1 1 1 1 /reset & wdt 1 1 1 1 1 1 1 1 n/a iocd wake-up from pin change p p p p p p p p www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom 56 ? product specification (v1.1) 03.13.2007 (this specification is subjec t to change without further notice) address name reset type bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 bit name wdte eis0 eis1 pswe psw2 psw1 psw0 lvdie power-on 0 0 0 0 0 0 0 0 /reset & wdt 0 0 0 0 0 0 0 0 n/a ioce wake-up from pin change p p p p p p p p bit name pwm3ie pwm2ie pwm1ie adie exie1 exie0 icie tcie power-on 0 0 0 0 0 0 0 0 /reset & wdt 0 0 0 0 0 0 0 0 n/a iocf wake-up from pin change p p p p p p p p bit name inte int ts te pste pst2 pst1 pst0 power-on 0 0 0 0 0 0 0 0 /reset & wdt 0 0 0 0 0 0 0 0 n/a cont wake-up from pin change p p p p p p p p bit name - - - - - - - - power-on u u u u u u u u /reset & wdt p p p p p p p p 0x00 r0(iar) wake-up from pin change p p p p p p p p bit name - - - - - - - - power-on 0 0 0 0 0 0 0 0 /reset & wdt 0 0 0 0 0 0 0 0 0x01 r1(tcc) wake-up from pin change p p p p p p p p bit name - - - - - - - - power-on 0 0 0 0 0 0 0 0 /reset & wdt 0 0 0 0 0 0 0 0 0x02 r2(pc) wake-up from pin change jump to address 0x08 or continue to execute next instruction bit name ps2 ps1 ps0 t p z dc c power-on 0 0 0 1 1 u u u /reset & wdt 0 0 0 t t p p p 0x03 r3(sr) wake-up from pin change p p p t t p p p bit name rbs1 rbs0 - - - - - - power-on 0 0 u u u u u u /reset & wdt 0 0 p p p p p p 0x04 r4(rsr) wake-up from pin change p p p p p p p p bit name p57 p56 p55 p54 p53 p52 p51 p50 power-on u u u u u u u u /reset & wdt u u u u u u u u 0x05 p5 wake-up from pin change p p p p p p p p www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom product specification (v 1.1) 03.13.2007 ? 57 (this specification is subject to change without further notice) address name reset type bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 bit name p67 p66 p65 p64 p63 p62 p61 p60 power-on u u u u u u u u /reset & wdt u u u u u u u u 0x06 p6 wake-up from pin change p p p p p p p p bit name p77 p76 p75 p74 p73 p72 p71 p70 power-on u u u u u u u u /reset & wdt u u u u u u u u 0x7 p7 wake-up from pin change p p p p p p p p bit name ?0? ?0? ?0? p84 p83 p82 p81 p80 power-on u u u u u u u u /reset & wdt u u u u u u u u 0x8 p8 wake-up from pin change p p p p p p p p bit name tmr47 tmr46 tmr45 tmr44 tmr43 tmr42 tmr41 tmr40 power-on 0 0 0 0 0 0 0 0 /reset & wdt 0 0 0 0 0 0 0 0 0x9 r9 (t4r) wake-up from pin change p p p p p p p p bit name srb7 srb6 srb5 srb4 srb3 srb2 srb1 srb0 power-on u u u u u u u u /reset & wdt u u u u u u u u 0xa ra (spir) wake-up from pin change p p p p p p p p bit name swb7 swb6 swb5 swb4 swb3 swb2 swb1 swb0 power-on 0 0 0 0 0 0 0 0 /reset and wdt 0 0 0 0 0 0 0 0 0xb rb (spiw) wake-up from pin change p p p p p p p p bit name dord td1 td0 t4ros od3 od4 ?0? rbf power-on 0 0 0 0 0 0 0 0 /reset & wdt 0 0 0 0 0 0 0 0 0xc rc (spisb) wake-up from pin change p p p p p p p p bit name ces spie sdo sse sdoc sbrs2 sbrs1 sbrs0 power-on 0 0 0 0 0 0 0 0 /reset & wdt 0 0 0 0 0 0 0 0 0xd rd (spicb) wake-up from pin change p p p p p p p p www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom 58 ? product specification (v1.1) 03.13.2007 (this specification is subjec t to change without further notice) address name reset type bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 bit name - - - lvdif adwe cmpwe icwe pwmwe power-on 0 0 0 0 0 0 0 0 /reset & wdt 0 0 0 0 0 0 0 0 0xe re (wucr) wake-up from pin change p p p p p p p p bit name pwm3if pwm2if pwm1if adif exif0 exif1 icif tcif power-on 0 0 0 0 0 0 0 0 /reset & wdt 0 0 0 0 0 0 0 0 0xf rf (isr) wake-up from pin change p p p p p p p p bit name pwm3e pwm2e pwm1e ?0? t1en t1p2 t1p1 t1p0 power-on 0 0 0 0 0 0 0 0 /reset & wdt 0 0 0 0 0 0 0 0 0x5 r5 (bank1) wake-up from pin change p p p p p p p p bit name t2en t2p2 t2p1 t2p0 t3en t3p2 t3p1 t3p0 power-on 0 0 0 0 0 0 0 0 /reset & wdt 0 0 0 0 0 0 0 0 0x6 r6 (bank 1) wake-up from pin change p p p p p p p p bit name ?0? ?0? ?0? ?0? t2ts t2te t1ts t1te power-on 0 0 0 0 0 0 0 0 /reset & wdt 0 0 0 0 0 0 0 0 0x7 r7 (bank 1) wake-up from pin change p p p p p p p p bit name prd1[9] prd1[8] prd1[7] prd1[6] prd1[5] prd1[4] prd1[3] prd1[2] power-on 0 0 0 0 0 0 0 0 /reset & wdt 0 0 0 0 0 0 0 0 0x8 r8 (bank 1) wake-up from pin change p p p p p p p p bit name prd2[9] prd2[8] prd2[7] prd2[6] prd2[5] prd2[4] prd2[3] prd2[2] power-on 0 0 0 0 0 0 0 0 /reset & wdt 0 0 0 0 0 0 0 0 0x9 r9 (bank 1) wake-up from pin change p p p p p p p p bit name prd3[9] prd3[8] prd3[7] prd3[6] prd3[5] prd3[4] prd3[3] prd3[2] power-on 0 0 0 0 0 0 0 0 /reset & wdt 0 0 0 0 0 0 0 0 0xa ra (bank 1) wake-up from pin change p p p p p p p p www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom product specification (v 1.1) 03.13.2007 ? 59 (this specification is subject to change without further notice) address name reset type bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 bit name ?0? ?0? prd3[1] prd3[0] prd2[1] prd2[0] prd1[1] prd1[0] power-on 0 0 0 0 0 0 0 0 /reset & wdt 0 0 0 0 0 0 0 0 0xb rb (bank 1) wake-up from pin change p p p p p p p p bit name dt1[9] dt1[8] dt1[7] dt1[6] dt1[5] dt1[4] dt1[3] dt1[2] power-on 0 0 0 0 0 0 0 0 /reset & wdt 0 0 0 0 0 0 0 0 0xc rc (bank 1) wake-up from pin change p p p p p p p p bit name dt2[9] dt2[8] dt2[7] dt2[6] dt2[5] dt2[4] dt2[3] dt2[2] power-on 0 0 0 0 0 0 0 0 /reset & wdt 0 0 0 0 0 0 0 0 0xd rd (bank 1) wake-up from pin change p p p p p 0 p p bit name dt3[9] dt3[8] dt3[7] dt3[6] dt3[5] dt3[4] dt3[3] dt3[2] power-on 0 0 0 0 0 0 0 0 /reset & wdt 0 0 0 0 0 0 0 0 0xe re (bank 1) wake-up from pin change p p p p p 0 p p bit name - - dt3[1] dt3[0] dt2[1] dt2[0] dt1[1] dt1[0] power-on 0 0 0 0 0 0 0 0 /reset & wdt 0 0 0 0 0 0 0 0 0xf rf (bank 1) wake-up from pin change p p p p p p p p bit name ten tck1 tck0 fscs ?0? ?0? ?0? ?0? power-on 0 0 0 0 0 0 0 0 /reset & wdt 0 0 0 0 0 0 0 0 0x6 r6 (bocr, bank 2) wake-up from pin change p p p p p p p p bit name t1s t2s t3s ?0? ?0? ?0? ?0? cpus power-on 0 0 0 0 0 0 0 1 /reset & wdt 0 0 0 0 0 0 0 1 0x7 r7 (scr, bank 2) wake-up from pin change p p p p p p p p bit name ade7 ade6 ade5 ade4 ade3 ade2 ade1 ade0 power-on 0 0 0 0 0 0 0 0 /reset & wdt 0 0 0 0 0 0 0 0 0x8 r8 (aisr, bank 2) wake-up from pin change p p p p p p p p www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom 60 ? product specification (v1.1) 03.13.2007 (this specification is subjec t to change without further notice) address name reset type bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 bit name vrefs ckr1 ckr0 adrun adpd adis2 adis1 adis0 power-on 0 0 0 0 0 0 0 0 /reset & wdt 0 0 0 0 0 0 0 0 0x9 r9 (adcon, bank 2) wake-up from pin change p p p p p p p p bit name cali sign vof[2] vof[1] vof[0] - - - power-on 0 0 0 0 0 0 0 0 /reset & wdt 0 0 0 0 0 0 0 0 0xa ra (adoc, bank 2) wake-up from pin change p p p p p p p p bit name ad11 ad10 ad9 ad8 ad7 ad6 ad5 ad4 power-on u u u u u u u u /reset & wdt u u u u u u u u 0xb rb (adddata, bank 2) wake-up from pin change p p p p p p p p bit name - - - - ad11 ad10 ad9 ad8 power-on 0 0 0 0 u u u u /reset & wdt 0 0 0 0 u u u u 0xc rc (addata1 h, bank 2) wake-up from pin change p p p p p p p p bit name ad7 ad7 ad5 ad4 ad3 ad2 ad1 ad0 power-on u u u u u u u u /reset & wdt u u u u u u u u 0xd rd (addata1 l, bank 2) wake-up from pin change p p p p p p p p bit name ?0? ?0? ?0? ?0? lvden /lvd lvd1 lvd0 power-on 0 0 0 0 0 1 0 0 /reset & wdt 0 0 0 0 0 1 0 0 0xe re (lvdc, bank 2) wake-up from pin change p p p p p p p p bit name tmr3h[9] tmr3h[8] tmr3h[7] tmr3h[6] tmr3h[5] tmr3h[4] tmr3h[3] tmr3h[2] power-on 0 0 0 0 0 0 0 0 /reset & wdt 0 0 0 0 0 0 0 0 0xf rf (timer3h, bank 2) wake-up from pin change p p p p p p p p bit name /pl57 /pl56 /pl55 /pl54 /pl53 /pl52 /pl51 /pl50 power-on 1 1 1 1 1 1 1 1 /reset & wdt 1 1 1 1 1 1 1 1 0x5 r5 (bank 3) wake-up from pin change p p p p p p p p www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom product specification (v 1.1) 03.13.2007 ? 61 (this specification is subject to change without further notice) address name reset type bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 bit name /pl67 /pl66 /pl65 /pl64 /pl63 /pl62 /pl61 /pl60 power-on 1 1 1 1 1 1 1 1 /reset & wdt 1 1 1 1 1 1 1 1 0x6 r6 (bank3) wake-up from pin change p p p p p p p p bit name /pl77 /pl76 /pl75 /pl74 /pl73 /pl72 /pl71 /pl70 power-on 1 1 1 1 1 1 1 1 /reset & wdt 1 1 1 1 1 1 1 1 0x7 r7 (bank3) wake-up from pin change p p p p p p p p bit name ?0? ?0? ?0? /pl84 /pl83 /pl82 /pl81 /pl80 power-on 0 0 0 1 1 1 1 1 /reset & wdt 0 0 0 1 1 1 1 1 0x8 r8 (bank3) wake-up from pin change p p p p p p p p bit name /ph57 /ph56 /ph55 /ph54 /ph53 /ph52 /ph51 /ph50 power-on 1 1 1 1 1 1 1 1 /reset & wdt 1 1 1 1 1 1 1 1 0x9 r9 (bank3) wake-up from pin change p p p p p p p p bit name /ph67 /ph66 /ph65 /ph64 /ph63 /ph62 /ph61 /ph60 power-on 1 1 1 1 1 1 1 1 /reset & wdt 1 1 1 1 1 1 1 1 0xa ra (bank3) wake-up from pin change p p p p p p p p bit name /ph77 /ph76 /ph75 /ph74 /ph73 /ph72 /ph71 /ph70 power-on 1 1 1 1 1 1 1 1 /reset & wdt 1 1 1 1 1 1 1 1 0xb rb (bank3) wake-up from pin change p p p p p p p p bit name ?0? ?0? ?0? /ph84 /ph83 /ph82 /ph81 /ph80 power-on 0 0 0 1 1 1 1 1 /reset & wdt 0 0 0 1 1 1 1 1 0xc rc (bank3) wake-up from pin change p p p p p p p p bit name tmr1h[9] tmr1h[8] tmr1h[7] tmr1h[6] tmr1h[5] tmr1h[4] tmr1h[1] tmr1h[0] power-on 0 0 0 0 0 0 0 0 /reset & wdt 0 0 0 0 0 0 0 0 0xd rd (tmr1h bank 3) wake-up from pin change p p p p p p p p www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom 62 ? product specification (v1.1) 03.13.2007 (this specification is subjec t to change without further notice) address name reset type bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 bit name tmr2h[9] tmr2h[8] tmr2h[7] tmr2h[6] tmr2h[5] tmr2h[4] tmr2h[3] tmr2h[2] power-on 0 0 0 0 0 0 0 0 /reset & wdt 0 0 0 0 0 0 0 0 0xe re (tmr2h, bank 3) wake-up from pin change p p p p p p p p bit name ?0? ?0? tmr3[1] tmr3[0] tmr2[1] tmr2[0] tmr1[3] tmr1[2] power-on 0 0 0 1 0 1 0 1 /reset & wdt 0 0 0 1 0 1 0 1 0xf rf(tmrl, bank 3) wake-up from pin change p p p p p p p p bit name - - - - - - - - power-on u u u u u u u u /reset & wdt p p p p p p p p 0x10 ~ 0x3f r10 ~ r3f wake-up from pin change p p p p p p p p legend: ? ? ? = not used ?p? = previous value before reset ?u? = unknown or don?t care ?t? = check ?reset type? table in section 6.5.2 6.7.1.3 controller reset block diagram wdt timeout oscillator d q clk clr wdt vdd setup time reset clk /reset power-on reset voltage detector wte fig. 6-18 controller reset block diagram www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom product specification (v 1.1) 03.13.2007 ? 63 (this specification is subject to change without further notice) 6.7.2 the t and p status under status register a reset condition is initiated by one of the following events : 1. power-on reset 2. /reset pin input "low" 3. wdt time-out (if enabled) the values of t and p as listed in the tabl e below, are used to check how the processor wakes up. reset type t p power-on 1 1 /reset during operating mode * p * p /reset wake-up during sleep mode 1 0 wdt during operating mode 0 * p wdt wake-up during sleep mode 0 0 wake-up on pin change during sleep mode 1 0 * p : previous status before reset the following shows the events that may affect the status of t and p. event t p power-on 1 1 wdtc instruction 1 1 wdt time-out 0 * p slep instruction 1 0 wake-up on pin changed during sleep mode 1 0 * p: previous value before reset 6.8 interrupt the EM78P330N has seven interrupts as listed below : 1. tcc overflow interrupt 2. port 6 input status change interrupt 3. external interrupt [(p52, /int0), (p53, /int1) pin] 4. analog-to-digital conversion completed 5. when tmr1/tmr2/tmr3 matches with prd1/prd2/prd3 respectively in pwm 6. when the comparators output changes (for EM78P330N only) 7. completion of serial interface transmit/receive before the port 6 input status change inte rrupt is enabled, reading port 6 (e.g., "mov r6, r6") is necessary. each port 6 pin will have this feature if it s status changes. any pin configured as output, including the p52 (/int0), and p53 (/int1), is excluded from this function. port 6 input status chang e interrupt will wake up the EM78P330N from sleep mode if it is enabled prior to going into sleep mode by executing slep. when wake-up occurs, the controller will continue to execute the succee ding program if the global interrupt is disabled. if enabled, it w ill branch out to the interrupt vector 008h. www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom 64 ? product specification (v1.1) 03.13.2007 (this specification is subjec t to change without further notice) external interrupt with digital noise rejection circuit (i nput pulse less than 8 system clock cycle) is eliminated as noise. edge selection is possible with /int. refer to word 1 bits 8~7 (section 6.16.2, code option register (word 1) ) for digital noise rejection definition. rf is the interrupt status register that re cords the interrupt requests in the relative flags/bits. iocf is an interrupt mask register. the global interrupt is enabled by the eni instruction and is disabled by the disi instruction. when one of the interrupts (when enabled) occurs, the next instruction w ill be fetched from address 008h. once in the interrupt service routine, the source of an interrupt can be determined by polling the flag bits in rf. the interrupt flag bit must be cleared by instructi ons before leaving the interrupt service routine to avoid recursive interrupts. the flag (except icif bit) in the interrupt stat us register (rf) is set regardless of the status of its mask bit or of the eni execution. note that the result of rf will be the logic and of rf and iocf (refer to the figur e below). the reti instruction ends the interrupt routine and enables the glo bal interrupt (the eni execution). fig. 6-19 interrupt input circuit www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom product specification (v 1.1) 03.13.2007 ? 65 (this specification is subject to change without further notice) 6.9 analog-to-digital converter (adc) the analog-to-digital circuitry consists of an 8-bit analog multiplexer; three control registers (aisr/r8, adcon/r9, and adoc/r a), three data registers (addata1/rb, addata1h/rc, & addata1l/rd) and an adc wi th 12-bit resolution as shown in the functional block diagram below. the analog reference voltage (vref) and the analog ground are connected via separate input pins. connecting to an external vref is more accurate than connecting to an internal vdd. the adc module utilizes successive approxi mation to convert the unknown analog signal into a digital value. the result is fed to the addata, addata1h and addata1l. input channels are selected by the analog input multiplexer via the adcon register bits. addata1h data bus adc3 adc2 adc1 adc0 adc4 adc5 adc6 adc7 vref power-down fsco internal rc 4-1 mux 7 ~ 0 3 4 adc ( successive approximation ) 3 5 6 adcon rf aisr adcon start to convert 0 1 2 adcon     " o b m p h  4 x j u d i 0 1 2 3 4 5 6 7 8 9 10 11 addata1l fig. 6-20 analog-to-digital conversion functional block diagram 6.9.1 adc control register (aisr/ bank 2 r8, adcon/ bank 2 r9, adoc/ bank 2 ra) 6.9.1.1 bank 2 r8 (aisr: adc input select register) bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 symbol ade7 ade6 ade5 ade4 ade3 ade2 ade1 * init_value 0 0 0 0 0 0 0 * init_value: initial value at power-on reset the aisr register individually defines the port 6 pins as analog inputs or as digital i/o. bit 7 (ade7): ad converter enable bit of p67 pin 0 = disable ain7, p67 functions as i/o pin 1 = enable ain7 to function as analog input pin bit 6 (ade6): ad converter enable bit of p66 pin 0 = disable ain6, p66 functions as i/o pin 1 = enable ain6 to function as analog input pin www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom 66 ? product specification (v1.1) 03.13.2007 (this specification is subjec t to change without further notice) bit 5 (ade5): ad converter enable bit of p65 pin 0 = disable ain5, p65 functions as i/o pin 1 = enable ain5 to function as analog input pin bit 4 (ade4): ad converter enable bit of p64 pin 0 = disable ain4, p64 functions as i/o pin 1 = enable ain4 to function as analog input pin bit 3 (ade3): ad converter enable bit of p63 pin 0 = disable ain3, p63 functions as i/o pin 1 = enable ain3 to function as analog input pin bit 2 (ade2): ad converter enable bit of p62 pin 0 = disable ain2, p63 functions as i/o pin 1 = enable ain2 to function as analog input pin bit 1 (ade1): ad converter enable bit of p61 pin 0 = disable ain1, p61 functions as i/o pin 1 = enable ain1 to function as analog input pin bit 0 (ade0): ad converter enable bit of p60 pin 0 = disable ain0, p60 functions as i/o pin 1 = enable ain0 to function as analog input pin note the p60/ain0 pin priority is as follows: 6.9.1.2 bank 2 r9 (adcon: adc control register) bit bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 symbol vrefs ckr1 ckr0 adrun adpd adis2 adis1 adis0 * init_value 0 0 0 0 0 0 0 0 * init_value : initial value at power on reset the adcon register controls the operation of the ad conversion and determines which pin should be currently active. bit 7(vrefs): the input source of the adc vref 0 = the adc vref is connected to vdd (default value), and the p84/vref pin carries out the function of p84. 1 = the adc vref is connected to p84/vref. p60/ade0 priority high low ain0 p60 www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom product specification (v 1.1) 03.13.2007 ? 67 (this specification is subject to change without further notice) bit 6 ~ bit 5 (ckr1 ~ ckr0): the prescaler oscillator clock rate of adc 00 = 1:16 (default value) 01 = 1: 4 10 = 1: 64 11 = 1: wdt ring oscillator frequency ckr1:ckr0 operation mode max. operation frequency 00 fosc/16 4mhz 01 fosc/4 1 mhz 10 fosc/64 16mhz 11 internal rc - bit 4 (adrun): adc starts to run 0 = reset on completion of the conversion. this bit cannot be reset though software. 1 = an ad conversion is started. this bit can be set by software. bit 3 (adpd): adc power-down mode. 0 = switch off the resistor re ference to save power even while the cpu is operating. 1 = adc is operating bit 2 ~ bit 0 (adis2 ~ adis0): analog input select. 000 = an0/p60 001 = an1/p61 010 = an2/p62 011 = an3/p63 100 = an4/p64 101 = an5/p65 110 = an6/p66 111 = an7/p67 these bits can only be changed when the adif bit and the adrun bit are both low. www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom 68 ? product specification (v1.1) 03.13.2007 (this specification is subjec t to change without further notice) 6.9.1.3 bank 2 ra (adoc: adc offset calibration register) bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 cali sign vof[2] vof[1] vof[0] ?0? ?0? ?0? bit 7 (cali): calibration enable bit for adc offset 0 = disable calibration 1 = enable calibration bit 6 (sign): polarity bit of offset voltage 0 = negative voltage 1 = positive voltage bit 5 ~ bit 3 (vof[2] ~ vof[0]): offset voltage bits vof[2] vof[1] vof[0] EM78P330N 0 0 0 0lsb 0 0 1 2lsb 0 1 0 4lsb 0 1 1 6lsb 1 0 0 8lsb 1 0 1 10lsb 1 1 0 12lsb 1 1 1 14lsb bit 2 ~ bit 0: unimplemented , read as ?0?. 6.9.2 adc data regist er (addata/bank 2 rb, addata1h/bank 2 rc, addata1l/bank 2 rd) when the ad conversion is completed, the result is loaded to the addata, addata1h and addata1l registers. the adrun bit is cleared, and the adif is set. 6.9.3 adc sampling time the accuracy, linearity, and speed of the successive approximation of ad converter are dependent on the properties of the adc and the comparator. the source impedance and the internal sampling impedance directly affect the time required to charge the sample holding capacitor. the application program controls the length of the sample time to meet the specified accuracy. gene rally speaking, the program should wait for 2 s for each k ? of the analog source impedance and at least 2 s for the low-impedance source. the maximum recommended impedance for analog source is 10k ? at vdd=5v. after the analog input channel is selected, th is acquisition time must be done before the conversion is started. 6.9.4 ad conversion time ckr1 and ckr0 select the conversion time (tct), in terms of instruction cycles. this allows the mcu to run at a maximum freque ncy without sacrificing the ad conversion accuracy. for the EM78P330N, the conversion time per bit is 4 s. www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom product specification (v 1.1) 03.13.2007 ? 69 (this specification is subject to change without further notice) the table below shows the relationship between tct and the maximum operating frequencies. ckr1: ckr0 operation mode max. operation frequency max. conversion rate/bit max. conversion rate 00 fosc/16 4mhz 250khz (4s) 15 4s=60s (16.7khz) 01 fosc/4 1mhz 250khz (4s) 15 4s=60s (16.7khz) 10 fosc/64 16mhz 250khz ( 4s) 15 4s=60s (16.7khz) 11 internal rc - 14khz (71s) 15 71s=1065s (0.938khz) note pin not used as an analog input pin can be used as regular input or output pin. during conversion, do not perform output in struction to maintain precision for all the pins. 6.9.5 adc operation during sleep mode in order to obtain a more accurate adc value and reduce power consumption, the ad conversion remains operational during sleep mode. as the slep instruction is executed, all the mcu operations will stop ex cept for the oscillato r, tcc, timer 1, timer 2, timer 3, timer 4 and ad conversion. the ad conversion is considered completed as determined by : 1. adrun bit of r9 register is cleared (?0? value) 2. wake-up from ad conversion (where it remains in operation during sleep mode) the results are fed into the addata, adda ta1h, and addata1l registers when the conversion is completed. if the adwe is enabled, the device will wake up. otherwise, the ad conversion will be shut off, no matte r what the status of adpd bit is. 6.9.6 programming process/considerations 6.9.6.1 programming process follow these steps to obtain data from the adc: 1. write to the 8 bits (ade7:ade0) on the bank 2 r8 (aisr) register to define the characteristics of r6 (digital i/o, analog channels, or voltage reference pin). 2. write to the bank 2 r9/adcon register to configure the ad module : a) select adc input channel (adis2: adis0). b) define ad conversion clock rate (ckr1: ckr0). c) select the vrefs input source of the adc. d) set the adpd bit to 1 to begin sampling. 3. set the adwe bit, if the wake-up function is employed. 4. set the adie bit, if the interrupt function is employed. 5. write ?eni? instruction, if t he interrupt function is employed. www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom 70 ? product specification (v1.1) 03.13.2007 (this specification is subjec t to change without further notice) 6. set the adrun bit to 1. 7. write ?slep? instruction or polling. 8. wait for wake-up or for adrun bit to be cleared (?0? value). 9. read the addata or addata1h and addata1l conversion data registers. if adc input channel changes at this time, the addata, addata1h, and addata1l values can be cleared to ?0?. 10. clear the interrupt flag bit (adif). 11. for next conversion, go to step 1 or step 2 as required. at least 2 tct is required before the next acquisition starts. note in order to obtain accurate values, it is necessary to avoid any data transition on i/o pins during ad conversion. 6.9.6.2 sample demo programs a. define a general registers r_0 == 0 ; indirect addressing register psw == 3 ; status register port5 == 5 port6 == 6 re== 0xe ; wake-up control resister rf== 0xf ; interrupt status register b. define a control register ioc50 == 0x5 ; control register of port 5 ioc60 == 0x6 ; control register of port 6 c_int== 0xf ; interrupt control register c. adc control register addata == 0xb ; the contents are the results of adc aisr == 0x08 ; adc input select register adcon == 0x9 ; 7 6 5 4 3 2 1 0 ; vrefs ckr1 ckr0 adrun adpd adis2 adis1 adis0 d. define bits in adcon adrun == 0x4 ; adc is executed as the bit is set adpd == 0x3 ; power mode of adc e. program starts org 0 ; initial address jmp initial ; org 0x08 ; interrupt vector ; ; www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom product specification (v 1.1) 03.13.2007 ? 71 (this specification is subject to change without further notice) ; (user program section) ; ; clr rf ; to clear the adif bit bs adcon, adrun ; to start to execute the next ad conversion ; if necessary reti initial: bank 1 mov a,@0b00000001 ; to define p60 as an analog input mov aisr,a mov a,@0b00001000 ; to select p60 as an analog input channel, and ad power on mov adcon,a ; to define p60 as an input pin and set clock ; rate at fosc/16 en_adc: mov a, @0bxxxxxxx1 ; to define p50 as an input pin, and the others iow port6 ; are dependent on applications mov a, @0bxxxx1xxx ; enable the adwe wake-up function of adc, ?x? ; by application mov re,a mov a, @0bxxxx1xxx ; enable the adie interrupt function of adc, ; ?x? by application iow c_int eni ; enable the interrupt function bs adcon, adrun ; start to run the adc ; if the interrupt function is employed, the following three lines may be ignored polling: jbc adcon, adrun ; to check the adrun bit continuously; jmp polling ; adrun bit will be reset as the ad conversion ; is completed ; ; ; (user program section) ; ; www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom 72 ? product specification (v1.1) 03.13.2007 (this specification is subjec t to change without further notice) 6.10 dual sets of pwm (pulse width modulation) 6.10.1 overview in pwm mode, pwm1, pwm2, and pwm3 pins generate a 10-bit resolution pwm output (see. the functional block diagram bel ow). a pwm output consists of a time period and a duty cycle, and it keeps the output high. the baud rate of the pwm is the inverse of the time period. fig. 6 -22 ( pwm output timing ) depicts the relationship between a time period and a duty cycle. data bus data bus prd1 comparator comparator tmr1h + tmr1l s rq mux duty cycle match period match pwm1 t1p2 t1p1 t1p0 t1en bank1-r5,7 prd2 comparator comparator s rq duty cycle match period match pwm2 to pwm1if to pwm2if reset reset latch latch 1:4 1:8 1:32 fosc 1:64 fosc tmr2h + tmr2l dt2h + dt2l dt1h + dt1l dl2h + dl2l dl2h + dl2l t2p2 t2p1 t2p0 t2en 1:2 1:16 1:128 1:256 mux 1:4 1:8 1:32 1:64 1:2 1:16 1:128 1:256 data bus data bus prd3 comparator comparator tmr3h + tmr3l s rq mux duty cycle match period match pwm3 t3p2 t3p1 t3p0 t3en to pwm3if reset latch 1:4 1:8 1:32 fosc 1:64 dt3h + dt3l dl3h + dl3l 1:2 1:16 1:128 1:256 bank1-r5,6 bank1-r5,5 fig. 6-21 the three pwms functional block diagram www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom product specification (v 1.1) 03.13.2007 ? 73 (this specification is subject to change without further notice) period duty cycle dt1 = tmr1 prd1 = tmr1 fig. 6-22 pwm output timing 6.10.2 increment timer counter (tmrx: tmr1h/twr1l, tmr2h /twr2l, or tmr3h/twr3l) tmrx are 10-bit clock counters with prog rammable prescalers. they are designed for the pwm module as baud rate clock generators. tmrx can be read only. if employed, they can be turned off for power saving by setting the t1en bit [bank 1 r5 <3>], t2en bit [bank 1 r6 <7>] or t3en bit [bank 1 r6 <3>] to 0. 6.10.3 pwm time period (prdx : prd1 or prd2 or prd3) the pwm time period is defined by writing to the prdx register. when tmrx is equal to prdx, the following events oc cur on the next increment cycle : ? tmrx is cleared ? the pwmx pin is set to 1 ? the pwm duty cycle is latched from dt1/dt2/dt3 to dl1/dl2/dl3 note the pwm output will not be set, if the duty cycle is 0. ? the pwmxif pin is set to 1 the following formula describes how to calculate the pwm time period : period = (prdx + 1) * (1/fosc) * clks/2 * (tmrx prescale value ) example : prdx=49; fosc=4mhz; clks bit of code option register =0 (2 oscillator periods); tmrx (0, 0, 0) = 1:2, then period=(49 + 1) * (1/4m) * 2/2 * 2 = 25us www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom 74 ? product specification (v1.1) 03.13.2007 (this specification is subjec t to change without further notice) 6.10.4 pwm duty cycle (dtx: dt1h/ dt1l, dt2h/ dt2l and dt3h/dt3l; dlx: dl1h/dl1l, dl2h/dl2l and dl3h/dl3l ) the pwm duty cycle is defined by writing to the dtx register, and is latched from dtx to dlx while tmrx is cleared. when dlx is equal to tmrx, the pwmx pin is cleared. dtx can be loaded anytime. however, it cannot be latched into dlx until the current value of dlx is equal to tmrx. the following formula describes how to calculate the pwm duty cycle : duty cycle = (dtx) * (1/fosc) * clks/2 * (tmrx prescale value ) example : dtx=10; fosc=4mhz; clks bit of code option register = 0 (2 oscillator periods); tmrx (0,0,0)=1:2, then duty cycle = 10 * (1/4m) * 2/2 * 2 =5us 6.10.5 comparator x changing the output status while a match oc curs will simultaneously set the tmrxif flag. 6.10.6 pwm programming process/steps 1. load prdx with the pwm time period. 2. load dtx with the pwm duty cycle. 3. enable interrupt function by writing iocf, if required. 4. set pwmx pin to be output by writing a desired value to bank1 r5 or r6. 5. load a desired value to bank1 r5 or r6 with tmrx prescaler value and enable both pwmx and tmrx. 6.11 timer 6.11.1 overview timer 1 (tmr1), timer 2 (tmr2), and timer 3 (tmr3) (tmrx) are 10-bit clock counters with programmable prescalers. they ar e designed for the pwm module as baud rate clock generators. tmrx can be read only. the timer 1, timer 2, and timer 3 will stop running when sleep mode occurs with ad conv ersion not running. however, if ad conversion is running when sleep mode occurs, the timer 1, timer 2 and timer 3, will keep on running. www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom product specification (v 1.1) 03.13.2007 ? 75 (this specification is subject to change without further notice) 6.11.2 function description the following figure shows the tmrx block diagram followed by descriptions of its signals and blocks : data bus data bus prd1 comparator tmr1x period match prd2 comparator tmr2x period match to pwm1if to pwm2if reset reset *tmr1x = tmr1h + tmr1l; *tmr2x = tmr2h + tmr2l; mux t1p2 t1p1 t1p0 t1en 1:4 1:8 1:32 1:64 1:2 1:16 1:128 1:256 fosc fosc t2p2 t2p1 t2p0 t2en mux 1:4 1:8 1:32 1:64 1:2 1:16 1:128 1:256 data bus data bus prd3 comparator tmr3x period match to pwm13f reset mux t3p2 t3p1 t3p0 t3en 1:4 1:8 1:32 1:64 1:2 1:16 1:128 1:256 fosc *tmr3x = tmr3h + tmr3l fig. 6-23 tmrx block diagram fosc: input clock. prescaler (t1p2, t1p1 and t1p0 / t2p2, t2 p1 and t2p0 / t3p2, t3p1 and t3p0): the options 1:2, 1:4, 1:8, 1:16, 1: 32, 1:64, 1:128, and 1:256 are defined by tmrx. it is cleared when any type of reset occurs. tmr1x, tmr2x and tmr3x (tmr1h/twr1l, tmr2h/tmr2l, & tmr3h/tmr3l): timer x register; tmrx is incremented until it matches with prdx, and then is reset to 1 (default valve). prdx (prd1/prd1h, prd2/prd2h and prd3/prd3h): pwm time period register. comparatorx (comparator 1 and comparator 2): reset tmrx while a match occurs. the tmrxif flag is set at the same time. www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom 76 ? product specification (v1.1) 03.13.2007 (this specification is subjec t to change without further notice) 6.11.3 programming the related registers when defining tmrx, refer to the related registers of its operation as shown in the table below. it must be noted that the pwmx bits must be disabled if their related tmrxs are employed. that is, bit 7 ~ bit 5 of the pwmcon register must be set to ?0?. 6.11.3.1 related control regist ers of tmr1, tmr2, and tmr3 address name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 0x05 pwmcon#1/bank1 r5 pwm3e pwm2e pwm1e ?0? t1en t1p2 t1p1 t1p0 0x06 pwmcon#2/bank1 r6 t2en t2p2 t2p1 t2p0 t3en t3p2 t3p1 t3p0 6.11.4 timer programming process/steps 1. load prdx with the timer duration 2. enable interrupt function by writing iocf, if required 3. load a desired a tmrx prescaler value to pwmcon and tmrcon and enable tmrx and disable pwmx 6.12 comparator EM78P330N has one comparator comprising of two analog inputs and one output. the comparator can be utilized to wake up the EM78P330N from sleep mode. the comparator circuit diagram is depicted in the figure below. cin - - + cmp cin+ co cin+ cin- output 10mv fig. 6-24 comparator circu it diagram & operating mode www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom product specification (v 1.1) 03.13.2007 ? 77 (this specification is subject to change without further notice) 6.12.1 external reference signal the analog signal that is presented at cin? compares to the signal at cin+, and the digital output (co) of the comparator is adjusted accordingly by taking the following notes into considerations : note the reference signal must be between vss and vdd. the reference voltage can be applied to either pin of the comparator. threshold detector applications may be of the same reference. the comparator can operate from the sa me or different reference sources. 6.12.2 comparator outputs ? the compared result is stored in the cmpout of ioca0. ? the comparator outputs are sent to co (p56) through programming bit 1, bit 0 of the ioca0 register to <1, 0>. see section 6.2.7, ioca0 (cmpcon: comparator control register) for comparator/op select bits function description . note the p56/co pin priority is as follows: the following figure shows the comp arator output block diagram. q q en en d d to c0 to cpif to cmpout cmrd cmrd from other comparator reset from op i/o fig. 6-25 comparator output configuration p56/co priority high low co p56 www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom 78 ? product specification (v1.1) 03.13.2007 (this specification is subjec t to change without further notice) 6.12.3 using comparator as an operation amplifier the comparator can be used as an operation amplifier if a feedback resistor is connected from the input to the output externa lly. in this case, the schmitt trigger can be disabled for power saving by setting bit 1, bit 0 of the ioca0 register to <1, 1>. see section 6.2.6, ioca0 (cmpcon: comparator control register) for comparator/op select bits function description . 6.12.4 comparator interrupt ? cmpie (ioce.0) must be enabled for the ?e ni? instruction to take effect. ? interrupt is triggered whenever a change occurs on the comparator output pin. ? the actual change on the pin can be determined by reading the bit cmpout, ioca0 < 2 >. ? cmpif (re.0), the comparator interrupt flag, can only be cleared by software. 6.12.5 wake-up from sleep mode ? if enabled, the comparator remains active and the interrupt remains functional, even in sleep mode. ? if a mismatch occurs, the interrupt will wake up the device from sleep mode. ? the power consumption should be taken into consideration for the benefit of energy conservation. ? if the function is unemployed during sleep mode, turn off the comparator before entering into sleep mode. 6.13 oscillator 6.13.1 oscillator modes the EM78P330N can be operated in four diff erent oscillator modes namely, high crystal oscillator mode (hxt), low crystal oscillator mode (lxt), external rc oscillator mode (erc), and rc oscillator mode with internal rc oscillator mode (irc). one of such modes can be selected by programming the osc2, ocs1, and osc0 in the code option register. the oscillator modes defined by osc2, ocs1, and osc0 are described below. oscillator modes osc2 osc1 osc0 erc 1 (external rc oscillator mode); p50/osco acts as p50 0 0 0 erc 1 (external rc oscillator mode); p50/osco acts as osco 0 0 1 irc 2 (internal rc oscillator mode); p50/osco acts as p50 0 1 0 irc 2 (internal rc oscillator mode); p50/osco acts as osco 0 1 1 lxt 3 (low crystal oscillator mode) 1 1 0 hxt 3 high crystal oscillator mode) (default) 1 1 1 1 in erc mode, osci is used as oscillator pin. os co/p50 is defined by code option word 0 bit 6 ~ bit 4. 2 in irc mode, p55 is normal i/o pin. osco/p50 is defined by code option word 0 bit 6 ~ bit 4. 3 in lxt and hxt modes; osci and osco are used as osc illator pins. these pins cannot and should not be defined as normal i/o pins. www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom product specification (v 1.1) 03.13.2007 ? 79 (this specification is subject to change without further notice) note the transient point of the system fre quency between hxt and lxy is 400khz. the maximum operating frequency limit of crys tal/resonator at different vdds, are as follows : conditions vdd max. freq. (mhz) 2.3 4 3.0 8 two clocks 5.0 20 6.13.2 crystal oscillator/ceramic resonators (crystal) the EM78P330N can be driven by an external clock signal through the osci pin as illustrated below. fig. 6-26 external clock input circuit www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom 80 ? product specification (v1.1) 03.13.2007 (this specification is subjec t to change without further notice) in the most applications, pin osci and pin osco can be connected with a crystal or ceramic resonator to generate oscillation. fig. 6-27 below depicts such a circuit. the same applies to the hxt mode and the lxt mode. fig. 6-27 crystal/resonator circuit the following table provides the recommended values for c1 and c2. since each resonator has its own attribute, user should refer to the resonator specifications for appropriate values of c1 and c2. rs, a serial resistor, may be required for at strip cut crystal or low frequency mode. capacitor selection guide for crystal oscillator or ceramic resonators : oscillator type frequency mode frequency c1 (pf) c2 (pf) 455 khz 100~150 100~150 2.0 mhz 20~40 20~40 ceramic resonators hxt 4.0 mhz 10~30 10~30 32.768 khz 25 15 100 khz 25 25 lxt 200 khz 25 25 455 khz 20~40 20~150 1.0 mhz 15~30 15~30 2.0 mhz 15 15 crystal oscillator hxt 4.0 mhz 15 15 6.13.3 external rc oscillator mode for some applications that do not require precise timing calculation, the rc oscillator (fig. 6-28 at right) offers a cost- effective solution. nevertheless, it should be noted that the frequency of the rc oscillator is influenced by the supply voltage, the values of the resistor (rext), the capacitor (cext), and even by the operation temperature. moreover, the frequency also changes slightly from one chip to another due to manufacturing process variations. fig. 6-28 external rc oscillator mode circuit www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom product specification (v 1.1) 03.13.2007 ? 81 (this specification is subject to change without further notice) in order to maintain a stable system frequency, the values of the cext should be no less than 20pf, and the value of rext should be no greater than 1m ? . if the frequency cannot be kept within this range, the fr equency can be affected easily by noise, humidity, and leakage. the smaller the rext in the rc oscillator is, the faster its frequency will be. on the contrary, for very low rext values, for instance, 1 k ? , the oscillator will become unstable because the nmos cannot correct ly discharge the capacitance current. based on the above reasons, it must be kept in mind that all supply voltage, the operation temperature, the components of the rc oscillator, the package types, and the way the pcb is layout, have certain effects on the system frequency. the rc oscillator frequencies : cext rext average fosc 5v, 25 c average fosc 3v, 25 c 3.3k 3.5 mhz 3.2 mhz 5.1k 2.5 mhz 2.3 mhz 10k 1.30 mhz 1.25 mhz 20 pf 100k 140 khz 140 khz 3.3k 1.27 mhz 1.21 mhz 5.1k 850 khz 820 khz 10k 450 khz 450 khz 100 pf 100k 48 khz 50 khz 3.3k 560 khz 540 khz 5.1k 370 khz 360 khz 10k 196 khz 192 khz 300 pf 100k 20 khz 20 khz note: 1 : measured based on dip packages. 2 : the values are for design reference only. 3 : the frequency drift is 30% 6.13.4 internal rc oscillator mode the EM78P330N offers a versatile internal rc mode with default frequency value of 4mhz. internal rc oscillator mode has ot her frequencies (1 mh z, 8 mhz, and 455 khz) that can be set by code option (word 1), rcm1, and rcm0. the table below describes the EM78P330N internal rc drift with voltage, temperature, and process variations. www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom 82 ? product specification (v1.1) 03.13.2007 (this specification is subjec t to change without further notice) internal rc drift ra te (ta=25c, vdd=5v ? 5%, vss=0v) drift rate internal rc frequency temperature (-40c~+85c) voltage (2.3v~5.5v) process total 4mhz 5% 5% 4% 14% 8mhz 5% 5% 4% 14% 1mhz 5% 5% 4% 14% 455mhz 5% 5% 4% 14% theoretical values are for reference only. actual values may vary depending on the actual process. 6.14 power-on considerations any microcontroller is not warranted to star t operating properly bef ore the power supply stabilizes to a steady state. the EM78P330N has a built-in power-on voltage detector (povd) with detection level range of 1.9v to 2.1v. the circuitry eliminates the extra external reset circuit. it w ill work well if vdd rises quickly enough (50 ms or less). however, under critical applications, extra dev ices are still required to assist in solving power-on problems. 6.14.1 external power-on reset circuit the circuits shown in the following figure implements an external rc to produce a reset pulse. the pulse width (time constant) should be kept long enough to allow vdd to reach the minimum operating voltage. this circuit is used when the power supply has a slow power rise time. because fig. 6-29 external power on reset circuit the current leakage from the /reset pin is about 5 a, it is recommended that r should not be greater than 40 k. this wa y, the voltage at pin /reset is held below 0.2v. the diode (d) functions as a short ci rcuit at power-down. the ?c? capacitor is discharged rapidly and fully. rin, the curr ent-limited resistor, prevents high current discharge or esd (electrostatic discha rge) from flowing into pin /reset. www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom product specification (v 1.1) 03.13.2007 ? 83 (this specification is subject to change without further notice) 6.14.2 residual voltage protection when the battery is replaced, device power (vdd) is removed but residual voltage remains. the residual voltage may trip below vdd minimum, but not to zero. this condition may cause a poor power-on reset. fig. 6-27 and fig. 6-31 show how to create a protection circuit against residual voltage. fig. 6-30 residual voltage protection circuit 1 fig. 6-31 residual voltage protection circuit 2 www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom 84 ? product specification (v1.1) 03.13.2007 (this specification is subjec t to change without further notice) 6.15 lvd (low voltage detector) during the power source unstable situation, su ch like external power noise interference of ems test condition, it will cause the po wer vibrate fierce. at the time the vdd is unsettled, it may be below working voltage. when system supplies voltage, vdd, below the working voltage, the ic kernel must ke ep all register status automatically. lvd property is setting at register re, bi t 1, 0 detail operation mode as follows: bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 ?0? ?0? ?0? ?0? lvden /lvd lvd1 lvd0 bits 1 ~ 0 (lvd1 ~ lvd0): low voltage detect level control bits. lvden lvd1,lvd0 lvd voltage interrupt level lvdif 1 11 2.2v 1 * 1 10 3.3v 1 * 1 01 4.0v 1 * 1 00 4.5v 1 * 0 xx na 0 * if vdd has crossover at lvd voltage interrupt level as vdd changes, lvdif =1. the lvd status and interrupt flag is referred to as rf register bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 rf ?0? ?0? ?0? lvdif adwe cmpwe icwe pwmwe note: ?1? means with interrupt request ?0? means no interrupt occurs bit 4 (lvdif): low voltage detector interrupt register the following steps are needed to setup the lvd function: set the lvden of register re of bank 2 to?1?, then use bit 1, 0 (lvd1, lvd0) of register re of bank 2 to set the lvd inte rrupt level while waiting for an interrupt to occur. the internal lvd module is using internal circuit to fit. when you set the lvden enable the lvd module. the current consumpti on will increase about 10a. during sleep mode, the lvd module continues to operate. if the device voltage drops slowly and crosses the detect point, the lvdif bit wi ll be set and device won?t wake up from sleep time. until the other wake-up source of EM78P330N, the lvd interrupt flag still set as the prior status. when the system resets, the lvd flag will be cleared. when vdd drops not below vlvd, lvdif remains at ?0?. www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom product specification (v 1.1) 03.13.2007 ? 85 (this specification is subject to change without further notice) when vdd drops below vlvd, lvdif is set to ?1?. if in global eni enable, lvdif will be set to ?1?, the next inst ruction will branch to an interrupt vector. the lvd interrupt flag is cleared to ?0? by software. when vdd drops below v reset to less than 80s, the syst em will ignore it and keep going. when vdd drops below v reset to more than 80s, a system reset will occur. refer to section 6.5.1 for reset description. 6.16 code option the EM78P330N has two code option words a nd one customer id word that are not part of the normal program memory. word 0 word 1 word 2 bit 12 ~ bit 0 bit 12 ~ bit 0 bit 12 ~ bit 0 6.16.1 code option register (word 0) word 0 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 - lvr1 lvr0 lce clks enwdtb osc2 osc1 osc0 hlp pr2 pr1 pr0 bit 12: unimplemented, read as ?0?. bits 11 ~ 10: low voltage reset enable bits. lvr1, lvr0 reset level release level 00 4.0v 4.2v 01 3.5v 3.7v 10 2.7v 2.9v 11 na na if vdd < 1.8v, the ic will be reset. if vdd < 2.7v, the ic will be reset. if vdd < 3.5v, the ic will be reset. if vdd < 4.0v, the ic will be reset. www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom 86 ? product specification (v1.1) 03.13.2007 (this specification is subjec t to change without further notice) bit 9 (lce): low crystal output enable 1 : select general-purpose i/o (p74, p73) 0 : low crystal 32.768khz mode. p74, p73 can be connected to a low crystal. bit 8 (clks): instruction time period option bit 0 = two oscillator time periods 1 = four oscillator time periods (default) refer to the section 6.15 for instruction set bit 7 (enwdtb): watchdog timer enable bit 0 = enable 1 = disable (default) bits 6, 5 & 4 (osc2, osc1 & osc0): oscillator modes selection bits oscillator modes osc2 osc1 osc0 erc 1 (external rc oscillator mode); p50/osco functions as p50 0 0 0 erc 1 (external rc oscillator mode); p50/osco functions as osco 0 0 1 irc 2 (internal rc oscillator mode); p50/osco functions as p50 0 1 0 irc 2 (internal rc oscillator mode); p50/osco functions as osco 0 1 1 lxt 3 (low crystal oscillator mode) 1 1 0 hxt 3 (high crystal oscillator mode) (default) 1 1 1 1 in erc mode, osci is used as oscillator pin. os co/p50 is defined by code option word 0 bit 6 ~ bit 4. 2 in irc mode, p51 is normal i/o pin. osco/p50 is defined by code option word 0 bit 6 ~ bit 4. 3 in lxt and hxt modes; osci and osco are used as osc illator pins. these pins cannot and should not be defined as normal i/o pins. note the transient point of the system fre quency between hxt and lxy is 400khz. bit 3 (hlp): power consumption selection 0 = low power consumption, applies to working frequency at 4mhz or below 4mhz 1 = high power consumption, applie s to working frequency above 4mhz bits 2 ~ 0 (pr2 ~ pr0): protect bit pr2 ~ pr0 are protection bits. ea ch protect status is as follows: pr2 pr1 pr0 protect 0 0 0 enable 1 1 1 disable www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom product specification (v 1.1) 03.13.2007 ? 87 (this specification is subject to change without further notice) 6.16.2 code option register (word 1) word 1 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 ? ? ? poren nrhl nre cyes c3 c2 c1 c0 rcm1 rcm0 bits 12~10: not used, (reserved). these bits are set to ?1? all the time. bit 9 (poren): power on reset enable/disable bit 0 = disable power-on reset 1 = enable power-on reset (default) bit 8 (nrhl): noise rejection high/low pulses defi ne bit when the signal at int pin has a falling edge trigger. 0 = pulses equal to 8/fc is regarded as signal 1 = pulses equal to 32/fc is regarded as signal (default) note the noise rejection function is turned off under the lxt and sleep mode. bit 7 (nre): noise rejection enable 0 = disable noise rejection 1 = enable noise rejection (default). however in low crystal oscillator (lxt) mode, the noise rejection circuit is always disabled. bit 6 (cyes): instruction cycle selection bit 0 = one instruction cycle 1 = two instruction cycles (default) bits 5, 4, 3 & bit 2 ( c3, c2, c1, & c0 ): internal rc mode calibration bits. these bits must always be set to ?1? only (auto calibration) bit 1 & bit 0 (rcm1 & rcm0): rc mode selection bits rcm 1 rcm 0 frequency (mhz) 1 1 4 1 0 8 0 1 1 0 0 455khz 6.15.3 customer id register (word 2) word 2 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 bits 12 ~ 0 : customer?s id code www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom 88 ? product specification (v1.1) 03.13.2007 (this specification is subjec t to change without further notice) 6.17 instruction set each instruction in the instruction set is a 13-bit word divided into an op code and one or more operands. normally, all instructi ons are executed within one single instruction cycle (one instruction consists of 2 oscillat or time periods), unless the program counter is changed by instructions "mov r2,a," "add r2,a," or by in structions of arithmetic or logic operation on r2 (e.g., "sub r2,a," "bs(c) r2,6," "clr r2," etc.). in this case, these instructions need one or two instru ction cycles as determined by code option register cyes bit. in addition, the instruction set has the following features : 1. every bit of any register can be set, cleared, or tested directly. 2. the i/o registers can be regarded as general registers. that is, the same instruction can operate on i/o registers. convention: r = register designator that specifies which one of the registers (including operation and general purpose registers) is to be ut ilized by the instruction. b = bit field designator that selects the value for the bit located in the register r and which affects the operation. k = 8 or 10-bit constant or literal value binary instruction hex mnemonic operation status affected 0 0000 0000 0000 0000 nop no operation none 0 0000 0000 0001 0001 daa decimal adjust a c 0 0000 0000 0010 0002 contw a cont none 0 0000 0000 0011 0003 slep 0 wdt, stop oscillator t, p 0 0000 0000 0100 0004 wdtc 0 wdt t, p 0 0000 0000 rrrr 000r iow r a iocr none 1 0 0000 0001 0000 0010 eni enable interrupt none 0 0000 0001 0001 0011 disi disable interrupt none 0 0000 0001 0010 0012 ret [top of stack] pc none 0 0000 0001 0011 0013 reti [top of stack] pc, enable interrupt none 0 0000 0001 0100 0014 contr cont a none 0 0000 0001 rrrr 001r ior r iocr a none 1 0 0000 01rr rrrr 00rr mov r,a a r none 0 0000 1000 0000 0080 clra 0 a z 0 0000 11rr rrrr 00rr clr r 0 r z 0 0001 00rr rrrr 01rr sub a,r r-a a z,c, dc 0 0001 01rr rrrr 01rr sub r,a r-a r z,c, dc 0 0001 10rr rrrr 01rr deca r r-1 a z 0 0001 11rr rrrr 01rr dec r r-1 r z www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom product specification (v 1.1) 03.13.2007 ? 89 (this specification is subject to change without further notice) binary instruction hex mnemonic operation status affected 0 0010 00rr rrrr 02rr or a,r a vr a z 0 0010 01rr rrrr 02rr or r,a a vr r z 0 0010 10rr rrrr 02rr and a,r a & r a z 0 0010 11rr rrrr 02rr and r,a a & r r z 0 0011 00rr rrrr 03rr xor a,r a r a z 0 0011 01rr rrrr 03rr xor r,a a r r z 0 0011 10rr rrrr 03rr add a,r a + r a z, c, dc 0 0011 11rr rrrr 03rr add r,a a + r r z, c, dc 0 0100 00rr rrrr 04rr mov a,r r a z 0 0100 01rr rrrr 04rr mov r,r r r z 0 0100 10rr rrrr 04rr coma r /r a z 0 0100 11rr rrrr 04rr com r /r r z 0 0101 00rr rrrr 05rr inca r r+1 a z 0 0101 01rr rrrr 05rr inc r r+1 r z 0 0101 10rr rrrr 05rr djza r r-1 a, skip if zero none 0 0101 11rr rrrr 05rr djz r r-1 r, skip if zero none 0 0110 00rr rrrr 06rr rrca r r(n) a(n-1), r(0) c, c a(7) c 0 0110 01rr rrrr 06rr rrc r r(n) r(n-1), r(0) c, c r(7) c 0 0110 10rr rrrr 06rr rlca r r(n) a(n+1), r(7) c, c a(0) c 0 0110 11rr rrrr 06rr rlc r r(n) r(n+1), r(7) c, c r(0) c 0 0111 00rr rrrr 07rr swapa r r(0-3) a(4-7), r(4-7) a(0-3) none 0 0111 01rr rrrr 07rr swap r r(0-3) ? r(4-7) none 0 0111 10rr rrrr 07rr jza r r+1 a, skip if zero none 0 0111 11rr rrrr 07rr jz r r+1 r, skip if zero none 0 100b bbrr rrrr 0xxx bc r,b 0 r(b) none 1 0 101b bbrr rrrr 0xxx bs r,b 1 r(b) none 2 0 110b bbrr rrrr 0xxx jbc r,b if r(b)=0, skip none 0 111b bbrr rrrr 0xxx jbs r,b if r(b)=1, skip none 1 00kk kkkk kkkk 1kkk call k pc+1 sp, (page, k ) pc none 1 01kk kkkk kkkk 1kkk jmp k (page, k ) pc none www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom 90 ? product specification (v1.1) 03.13.2007 (this specification is subjec t to change without further notice) binary instruction hex mnemonic operation status affected 1 1000 kkkk kkkk 18kk mov a,k k a none 1 1001 kkkk kkkk 19kk or a,k a k a z 1 1010 kkkk kkkk 1akk and a,k a & k a z 1 1011 kkkk kkkk 1bkk xor a,k a k a z 1 1100 kkkk kkkk 1ckk retl k k a, [top of stack] pc none 1 1101 kkkk kkkk 1dkk sub a,k k-a a z,c,dc 1 1110 1000 kkkk 1e8k page k k r1(5:4) none 1 1110 1001 kkkk 1e9k bank k k r1(1:0) none 1 1111 kkkk kkkk 1fkk add a,k k+a a z, c, dc note: 1 this instruction is applicable to ioc50 ~ iocf, ioc51 ~ iocf1 only. 2 this instruction is not recommended for rf operation 3 this instruction cannot operate under rf. 7 absolute maximum ratings items rating temperature under bias -40 c to 85 c storage temperature -65 c to 150 c input voltage vss-0. 3v to vdd+0.5v output voltage vss-0.3v to vdd+0.5v working voltage 2.3v to 5.5v working frequency dc to 20mhz www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom product specification (v 1.1) 03.13.2007 ? 91 (this specification is subject to change without further notice) 8 dc electrical characteristics ta= 25 c, vdd= 5.0v, vss= 0v symbol parameter condition min. typ. max. unit crystal: vdd to 5v dc 20 mhz crystal: vdd to 3v two cycles with two clocks dc 8 mhz fxt erc: vdd to 5v r: 5.1k ? , c: 100 pf f 30 % 850 f 30 % khz vihrc input high threshold voltage (schmitt trigger ) osci in rc mode ? 3.5 ? v vilrc input low threshold voltage (schmitt trigger ) osci in rc mode ? 1.5 ? v iil input leakage current for input pins vin = vdd, vss ?1.0 0 1.0 a vih1 input high voltage (schmitt trigger ) ports 5, 6, 7, 8 ? 3.75 ? v vil1 input low voltage (schmitt trigger ) ports 5, 6, 7, 8 ? 1.25 ? v viht1 input high threshold voltage (schmitt trigger ) /reset ? 2.0 ? v vilt1 input low threshold voltage (schmitt trigger ) /reset ? 1.0 ? v viht2 input high threshold voltage (schmitt trigger ) tcc,int ? 3.75 ? v vilt2 input low threshold voltage (schmitt trigger ) tcc,int ? 1.25 ? v vihx1 clock input high voltage osci in crystal mode ? 3.5 ? v vilx1 clock input low voltage osci in crystal mode ? 1.5 ? v ioh1 output high voltage (ports 50~53, ports 60~63) (ports 70~77, ports 80~84) voh = vdd-0.5v (ioh =-6ma) ? -9.0 ? ma ioh2 output high voltage (ports p54~p57, p64~p67) voh = vdd-0.5v (ioh =-9ma) ? -12.0 ? ma iol1 output low voltage (ports 50~53, ports 60~63) (ports 70~77, ports 80~84) vol = gnd+0.5v (iol =12ma) ? 18.0 ? ma iol2 output low voltage (ports p54~p57, p64~p67) vol = gnd+0.5v (iol =24ma) ? 24.0 ? ma ibol output sink current buzzer output sink current ? 24 ? ma iboh output drive current buzzer output drive current ? 24 ? ma iph pull-high current pull-high active, input pin at vss ?50 ?75 ?240 a ipl pull-low current pull-low active, input pin at vdd 25 40 120 a isb1 power down current all input and i/o pins at vdd, output pin floating, wdt disabled ? 1.0 2.0 a isb2 power down current all input and i/o pins at vdd, output pin floating, wdt enabled ? ? 15 a icc1 operating supply current at two clocks /reset= 'high', fosc=32khz, (crystal type, clks="0"), output pin floating, wdt disabled 15 20 35 a icc2 operating supply current at two clocks /reset= 'high', fosc=32khz (crystal type, clks="0"), output pin floating, wdt enabled 25 35 a icc3 operating supply current at two clocks /reset= 'high', fosc=4mhz (crystal type, clks="0"), output pin floating, wdt enabled 1.7 2.2 ma icc4 operating supply current at two clocks /reset= 'high', fosc=10mhz (crystal type, clks="0"), output pin floating, wdt enabled 3.0 3.5 ma www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom 92 ? product specification (v1.1) 03.13.2007 (this specification is subjec t to change without further notice) internal rc electrical characteristics (ta=25 c, vdd=5 v, vss=0v) drift rate internal rc temperature voltage min. typ. max. 4mhz 25 5 v 3.86mhz 4mhz 4.16mhz 8mhz 25 5 v 7.68mhz 16mhz 8.32mhz 1mhz 25 5 v 0.96mhz 1mhz 1.04mhz 455khz 25 5 v 436.5khz 455khz 473.2khz internal rc electrical ch aracteristics (ta=-40 ~85 c, vdd=2.2~5.5 v, vss=0v) drift rate internal rc temperature voltage min. typ. max. 4mhz -40 ~85 2.2~5.5 v 3.44mhz 4mhz 4. 76mhz 8mhz -40 ~85 2.2~5.5 v 6.88mhz 8mhz 9.12mhz 1mhz -40 ~85 2.2~5.5 v 0.86mhz 1mhz 1.14mhz 455khz -40 ~85 2.2~5.5 v 391.3khz 455khz 518.7khz 8.1 ad converter characteristic vdd=2.5v to 5.5v, vss=0v, ta=25c symbol parameter condition min. typ. max. unit v aref 2.3 ? vdd v v ass analog reference voltage v aref - v ass 2.3v vss ? vss v vai analog input voltage ? v ass ? v aref v ivdd 750 850 1000 a iai1 ivref analog supply current vdd=v aref =5.0v, v ass =0.0v (v reference from vdd) -10 0 +10 a ivdd 500 600 820 a iai2 ivref analog supply current vdd=v aref =5.0v, v ass =0.0v (v reference from vref) 200 250 300 a iop op current vdd=5.0v, op used output voltage swing 0.15v to 4.85v 450 550 650 a rn1 resolution adref=0, internal vdd vdd=5.0v, v ass =0.0v ? 9 10 bits rn2 resolution adref=1, external vref vdd=vref=5.0v, vss = 0.0v ? 11 12 bits ln1 linearity error vdd = 2.3 to 5.5v ta=25 c 0 4 8 lsb ln2 linearity error vdd= 2.5 to 5.5v ta=25 c 0 2 4 lsb dnl differential nonlinear error vdd = 2.3 to 5.5v ta=25 c 0 0.5 0.9 lsb fse1 full scale error vdd=v aref =5.0v, v ass =0.0v 0 4 8 lsb fse2 full scale error vdd=vref=5 .0v, vss = 0.0v 0 2 4 lsb oe offset error vdd=v aref =5.0v, v ass =0.0v 0 2 4 lsb www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom product specification (v 1.1) 03.13.2007 ? 93 (this specification is subject to change without further notice) symbol parameter condition min. typ. max. unit zai recommended impedance of analog voltage source ? 0 8 10 k ? tad adc clock duration vdd=v aref =5.0v, v ass =0.0v 4 ? ? us tcn ad conversion time vdd=v aref =5.0v, v ass =0.0v 15 ? 15 tad adiv adc op input voltage range vdd=v aref =5.0v, v ass =0.0v 0 ? v aref v 0 0.2 0.3 adov adc op output voltage swing vdd=v aref =5.0v, v ass =0.0v, rl=10k ? 4.7 4.8 5 v adsr adc op slew rate vdd=v aref =5.0v, v ass =0.0v 0.1 0.3 ? v/us psr power supply rejection vdd=5.0v0.5v 0 ? 2 lsb note: 1. these parameters are hypothetical (not test ed) and are provided for des ign reference use only. 2. there is no current consumption when ad c is off other than minor leakage current. 3. ad conversion result will not decrease when an increase of input voltage and no missing code will result. 4. these parameters are subject to change without further notice. 8.2 comparator (op) characteristic vdd = 5.0v, vss=0v, ta=25c symbol parameter condition min. typ. max. unit sr slew rate ? 0.1 0.2 v/us ivr input voltage range vdd =5.0v, v ss =0.0v 0 5 v 0 0.2 0.3 ovs output voltage swing vd =5.0v, v ss =0.0v, rl=10k ? 4.7 4.8 5 v iop supply current of op ? 250 350 500 a ico supply current of comparator ? ? 300 ? a psrr power-supply rejection ration for op vdd= 5.0v, v ss =0.0v 50 60 70 db vs operating range ? 2.5 ? 5.5 v note: 1. these parameters are hypothetical (not test ed) and are provided for design reference use only. 2. these parameters are subject to change without further notice. www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom 94 ? product specification (v1.1) 03.13.2007 (this specification is subjec t to change without further notice) 8.3 device characteristics the graphs below were derived based on a limited number of samples and they are provided for reference only. hence, the device characteristic shown herein cannot be guaranteed as fully accurate. in these gr aphs, the data maybe out of the specified operating warranted range. fig. 8-1 internal rc osc freque ncy vs. temperature, vdd=3v irc osc frequency (vdd=5v)              temperature ( 
) frequency (m hz) . fig. 8-2 internal rc osc frequency vs. temperature, vdd=5v www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom product specification (v 1.1) 03.13.2007 ? 95 (this specification is subject to change without further notice) 9 ac electrical characteristic ta=25 c, vdd=5v 5%, vss=0v symbol parameter conditions min type max unit dclk input clk duty cycle ? 45 50 55 % crystal type 100 ? dc ns tins instruction cycle time (clks="0") rc type 500 ? dc ns ttcc tcc input time period ? (tins+20) n * ? ? ns tdrh device reset hold time ta = 25 c 11.3 16.2 21.6 ms trst /reset pulse width ta = 25 c 2000 ns twdt watchdog timer duration ta = 25 c 11.3 16.2 21.6 ms tset input pin setup time ? ? 0 ns thold input pin hold time ? 15 20 25 ns tdelay output pin delay time cload=20pf 45 50 55 ns tdrc erc delay time ta = 25 c 1 3 5 ns note: * n = selected prescaler ratio www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom 96 ? product specification (v1.1) 03.13.2007 (this specification is subjec t to change without further notice) 10 timing diagrams reset timing (clk="0") clk /reset nop instruction 1 executed tdrh tcc input timing (clks="0") clk tcc ttcc tins ac testing : input is driven at vdd-0.5v for logic "1",and gnd+0.5v for logic "0".timing measurements are made at 0.75vdd for logic "1",and 0.25vdd for logic "0". ac test input/output waveform vdd-0.5v gnd+0.5v 0.75vdd 0.25vdd test points 0.75vdd 0.25vdd www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom product specification (v 1.1) 03.13.2007 ? 97 (this specification is subject to change without further notice) appendix a package type otp mcu package type package size pin count EM78P330Np dip 600mil 28 pins EM78P330Nps/npj dip 600mil 28 pins EM78P330Nm sop 300mil 28 pins EM78P330Nms/nmj sop 300mil 28 pins EM78P330Nk sdip 400mil 28 pins EM78P330Nks/nkj sdip 400mil 28 pins EM78P330Nak sdip 300mil 28 pins EM78P330Naks/nakj sdip 300mil 28 pins em78p331nm sop 300mil 32 pins em78p331nms/nmj sop 300mil 32 pins em78p331nk skinny dip 400mil 32 pins em78p331nks/nkj skinny dip 400mil 32 pins em78p331nq lqfp 7*7m 2 32 pins em78p331nqs/nqj lqfp 7*7m 2 32 pins em78p331np dip 600mil 32 pins em78p331nps/npj dip 600mil 32 pins green products do not contai n hazardous substances. the third edition of sony ss-00259 standard. pb contents should be less the 100ppm pb contents comply with sony specs. part no. em78p330/1nxs/xj electroplate type pure tin ingredient (%) sn: 100% melting point(c) 232c electrical resistivity ( ? -cm) 11.4 hardness (hv) 8~10 elongation (%) >50% www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom 98 ? product specification (v1.1) 03.13.2007 (this specification is subjec t to change without further notice) b packaging configuration b.1 28-lead plastic dual in line (pdip) { 600 mil www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom product specification (v 1.1) 03.13.2007 ? 99 (this specification is subject to change without further notice) b.2 28-lead plastic small outline (sop) { 300 mil www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom 100 ? product specification (v1.1) 03.13.2007 (this specification is subjec t to change without further notice) b.3 28-lead shrink dual in line (sdip) { 400 mil www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom product specification (v 1.1) 03.13.2007 ? 101 (this specification is subject to change without further notice) b.4 28-lead shrink dual in line (sdip) { 300 mil www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom 102 ? product specification (v1.1) 03.13.2007 (this specification is subjec t to change without further notice) b.5 32-lqfp 7 7 7m 2 www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom product specification (v 1.1) 03.13.2007 ? 103 (this specification is subject to change without further notice) b.6 32-lead shrink dual in line (sdip) { 400 mil www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom 104 ? product specification (v1.1) 03.13.2007 (this specification is subjec t to change without further notice) b.7 32-lead plastic dual in line (pdip) { 600 mil www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom product specification (v 1.1) 03.13.2007 ? 105 (this specification is subject to change without further notice) b.8 32-lead plastic small outline (sop) { 300 mil www.datasheet.net/ datasheet pdf - http://www..co.kr/
em78p330/331n 8-bit microprocessor with otp rom 106 ? product specification (v1.1) 03.13.2007 (this specification is subjec t to change without further notice) c quality assurance and reliability test category test conditions remarks solderability solder temperature = 255 5c, for 5 seconds up to the stopper using a rosin-type flux ? step 1 : tct, 65c (15mins) ~ 150c (15mins), 10 cycles step 2 : bake at 125c, td (endurance) = 24 hrs step 3 : soak at 30 c / 60% , td (endurance) = 192 hrs pre-condition step 4 : ir flow 3 cycles (pkg thickness 2.5mm or pkg volume 350 mm3 ----235 5c) (pkg thickness 2.5 mm or pkg volume 350 mm3 ----250 5c) for smd ic (such as sop, qfp, soj, etc) temperature cycle test -65 c (15mins)~150 c (15mins), 200 cycles ? pressure cooker test ta =121c, rh=100%, pressure=2 atm, td (endurance)= 96 hrs ? high temperature / high humidity test ta=85 c , rh=85% d td (endurance) = 168, 500 hrs ? high-temperature storage life ta=150c, td (endurance) = 500, 1000 hrs ? high-temperature operating life ta=125c, vcc = max. operating voltage, td (endurance) = 168, 500, 1000 hrs ? latch-up ta=25c, vcc = max. oper ating voltage, 600 ma / 40v ? esd (hbm) ta=25c, t? 3kv t esd (mm) ta=25c, t? 300v t ip_nd,op_nd,io_nd ip_ns,op_ns,io_ns ip_pd,op_pd,io_pd, ip_ps,op_ps,io_ps, vdd-vss(+),vdd_vss (-) mode c.1 address trap detect an address trap detect is one of the mcu em bedded fail-safe functions that detects mcu malfunction caused by noise or the like. whenever the mcu attempts to fetch an instruction from a certain section of rom, an in ternal recovery circuit is auto started. if a noise caused address error is detected, t he mcu will repeat execution of the program until the noise is eliminated. the mcu will t hen continue to execute the next program. www.datasheet.net/ datasheet pdf - http://www..co.kr/


▲Up To Search▲   

 
Price & Availability of EM78P330N

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X